[Solved] Formatting Documents to Read Easier

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
sokolowitzky
Posts: 103
Joined: Mon Sep 15, 2014 7:34 pm

[Solved] Formatting Documents to Read Easier

Post by sokolowitzky »

I've seen an API that makes reading easier, setting first few characters of each word in a text bold.
theapi.PNG
theapi.PNG (56.12 KiB) Viewed 1327 times
I've found it very useful.
I have some sheets that contain some articles(which is improper to the purpose of the "calc", I know that)
If I try manually, to turn some characters to bold and let other ones as regular font, it can be done.
Image But, since the basic treats each cell as an object that can't be separated to multiple parts, apparently it won't let me do such a change inside of a cell.


Do you have any idea that might help bypass this? Even though I can't think up a clear solution, may be a particular font type can be used? or may be a way to display all cells together(1 cell with bold characters+ 1 regular), turning each cell's lenght to a minimum and somehow manipulating ooo so that it doesn't limit displaying the exceeding characters?
attentat.PNG
attentat.PNG (1.9 KiB) Viewed 1327 times
Attachments
apicisepic.PNG
apicisepic.PNG (3.55 KiB) Viewed 1327 times
Last edited by sokolowitzky on Sun Jul 10, 2022 8:09 pm, edited 2 times in total.
Win10-OpenOffice 4.1/LibreOffice 7.4
User avatar
Hagar Delest
Moderator
Posts: 32653
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Formatting Documents to Read Easier

Post by Hagar Delest »

Why use Calc for that???

In Writer it would be quite easy, the macro would just have to go through each word, take its length, take 50% of it (rounding to the closest integer) and then applying bold formatting on the left part of the string.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
sokolowitzky
Posts: 103
Joined: Mon Sep 15, 2014 7:34 pm

Re: Formatting Documents to Read Easier

Post by sokolowitzky »

There are texts from different sources, and I use grid address to call part of texts, according to parameters.
Last edited by sokolowitzky on Thu May 26, 2022 4:00 am, edited 1 time in total.
Win10-OpenOffice 4.1/LibreOffice 7.4
JeJe
Volunteer
Posts: 2779
Joined: Wed Mar 09, 2016 2:40 pm

Re: Formatting Documents to Read Easier

Post by JeJe »

Code: Select all

c= thiscomponent.sheets(0).getcellbyposition(0,0)
tc=c.text.createtextcursorbyrange(c.text.start)
tc.goright(2,true)
tc.charweight = 150

Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Post Reply