[Solved] Change paragraph properties
Posted: Mon Apr 14, 2014 5:48 pm
I want to change the line spacing of paragraphs. I am a beginner at LibreOffice macro writing, and this mostly useful document https://wiki.openoffice.org/wiki/Docume ... _Documents seems to say that paragraph properties work pretty much the same as character properties. But it has no actual examples. When I enumerate paragraphs, the character properties change correctly, but the corresponding paragraph properties don't change (though the assignment is syntactically correct).
So now the paragraphs are Arial 12 but their lines are not 1.5 lines apart and the background is still plain old white. How do I change the para properties? I've tried every permutation I can think of - using LineSpacing and SetPropertyValue and whatnot. Of course I can record a macro that starts with Select All and that shows me that it uses .uno:LineSpacing, Name = LineSpacing.Height, but I don't know how to turn that into proper Basic as above. Thank you.
Code: Select all
doc = thiscomponent
enum = doc.text.createenumeration
while enum.hasmoreelements
elem = enum.nextelement
if elem.supportsservice("com.sun.star.text.Paragraph") then
elem.charfontname = "Arial"
elem.charheight = 12
elem.paralinespacing.height = 150
elem.parabackcolor(rgb(200,200,0))
end if
wend