I'm looking in the Forum and the documentation for quite some time and couldn't find it...
I have managed to create a TOC with the use of levels
oCurs.NumberingLevel = "Level 2" 'attribute of the text, in order to include it in the TOC
oCurs.ParaStyleName = "Heading 2" 'attribute of the text, so that it looks like heading
and the appropriate command in the end
I have managed to change the properties of lines or paragraphs using both a view and a text cursor, for example with
xTextCursor.CharPosture=com.sun.star.awt.FontSlant.ITALIC (the xTextcursor has already a selection).
I cannot find a way to do the same with bullets and numbering. I already tried:
fvc.ParaStyleName = "Numbering 1" (fvc is a text or view cursor)
This changed the style of the lines (1,5 lines pro line) but I see no Numbering (or bullets, when i use "List 1" instead of "numbering 1")
Does somebody have an idea, how to create a macro like this, a starbasic macro that creates bullets or numbering in the current selection (when possible using a text or view cursor)?
PS. I already tried to use the macro record function, didn't help in this case...
thanks!
[Solved] Starbasic Macro for bullets and numbering look
[Solved] Starbasic Macro for bullets and numbering look
Last edited by Hagar Delest on Sat Jul 30, 2016 9:49 pm, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
OpenOffice3.1 on UBUNTU 12.04
Re: How does a starbasic Macro for bullets and numbering loo
This code adds numbering and bullets to the first two paragraphs of a document. The first paragraph just gets numbering turned on, so it gets the zero level numbering default, which is an Arabic number. The second paragraph gets set to level 1 which the code has modified to get a bullet.
Code: Select all
oNumRules = ThisComponent.createInstance("com.sun.star.text.NumberingRules") 'create numbering rules
'Get the Level 1 rule and change it to show a bullet
oRule1 = oNumRules.getByIndex(1)
for i = 0 to UBOUND(oRule1)
if oRule1(i).Name = "NumberingType" Then
oRule1(i).Value = com.sun.star.style.NumberingType.CHAR_SPECIAL
End If
next i
oNumRules.replaceByIndex(1, oRule1)
oText = ThisComponent.Text
oCurs = oText.createTextCursor()
oCurs.NumberingRules = oNumRules
oCurs.gotoNextParagraph(False) ' go to 2nd paragraph
oCurs.NumberingRules = oNumRules
oCurs.NumberingLevel = 1
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: How does a starbasic Macro for bullets and numbering loo
super!! thanks!!!
OpenOffice3.1 on UBUNTU 12.04
Re: How does a starbasic Macro for bullets and numbering loo
Thank you FJCC, it looks like your comment is an indirect answer to my question at the bottom of this comment.FJCC wrote:The first paragraph just gets numbering turned on, so it gets the zero level numbering default, which is an Arabic number. The second paragraph gets set to level 1 which the code has modified to get a bullet.
Is it correct to say that there is a max level of nesting for lists, 0…9, which relates to the number of NumberingRules per paragraph? And if a numbering paragraph has a NumberingLevel value of N then rule N applies to that particular paragraph?
Mac 10.14 using LO 7.2.0.2, Gentoo Linux using LO 7.2.3.2 headless.