[Solved] Writer: modify outline numbering parameters

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
Mr.Dandy
Posts: 427
Joined: Tue Dec 11, 2012 4:22 pm

[Solved] Writer: modify outline numbering parameters

Post by Mr.Dandy »

Hello forum,

I would like to set parameters by macro for outline numbering.
If I inspect a document with MRI, I found NumberingRules property.
But this interface is in read only.
How can I proceed?
Last edited by Mr.Dandy on Fri Aug 17, 2018 2:53 pm, edited 1 time in total.
OpenOffice 4.1.12 - Windows 10
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: Writer: modify outline numbering parameters

Post by JeJe »

NumberingLevel, NumberingRules etc set at the paragraph level.

https://www.openoffice.org/api/docs/com ... rties.html
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Mr.Dandy
Posts: 427
Joined: Tue Dec 11, 2012 4:22 pm

Re: Writer: modify outline numbering parameters

Post by Mr.Dandy »

Thanks for the clue.

But I don't see some parameters in ParagraphProperties.
14314752832109435.png
For example, how can I reach Separator's fields to have "Lesson" and "Study notes"?
OpenOffice 4.1.12 - Windows 10
sasa
Posts: 11
Joined: Wed Feb 08, 2017 12:54 am

Re: Writer: modify outline numbering parameters

Post by sasa »

Hi,



try NumberingLevel service https://www.openoffice.org/api/docs/com ... Level.html

Best
LibreOffice 6.3 on Xubuntu 18.04
UnklDonald418
Volunteer
Posts: 1544
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Writer: modify outline numbering parameters

Post by UnklDonald418 »

Based on the code I found in Listing 7.64 of Andrew Pitonyak's document "Useful Macro Information", the following appears to work.

Code: Select all

Sub CheckOutLine()
Dim i%, j%
Dim oRules
Dim oRule()
Dim oProp
oRules = ThisComponent.getChapterNumberingRules()
For i = 0 To oRules.getCount() - 1
	oRule() = oRules.getByIndex(i)
REM I do not set the following:
REM Adjust, LeftMargin,
REM SymbolTextDistance, FirstLineOffset
	For j = LBound(oRule()) To Ubound(oRule())
		REM oProp is only a copy of the property.
		REM You must assign the property back into the array.
		oProp = oRule(j)
		Select Case oProp.Name
		Case "HeadingStyleName"
			'oProp.Value = sNames(i)
		Case "NumberingType"
			'oProp.Value = com.sun.star.style.NumberingType.ARABIC
		Case "ParentNumbering"
			'oProp.Value = i + 1
		Case "Prefix"
			oProp.Value = "Lesson"
		Case "Suffix"
			oProp.Value = "Study Notes"
		Case "StartWith"
			oProp.Value = 8
		End Select
		oRule(j) = oProp
	Next
oRules.replaceByIndex(i, oRule())
Next
End Sub

If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
User avatar
Mr.Dandy
Posts: 427
Joined: Tue Dec 11, 2012 4:22 pm

Re: Writer: modify outline numbering parameters

Post by Mr.Dandy »

Thanks UnklDonald (and so Sir Pitonyak) :bravo:
OpenOffice 4.1.12 - Windows 10
Post Reply