Page 1 of 1
[Solved] Writer: modify outline numbering parameters
Posted: Thu Jun 28, 2018 2:21 pm
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?
Re: Writer: modify outline numbering parameters
Posted: Thu Jun 28, 2018 9:50 pm
by JeJe
NumberingLevel, NumberingRules etc set at the paragraph level.
https://www.openoffice.org/api/docs/com ... rties.html
Re: Writer: modify outline numbering parameters
Posted: Mon Aug 13, 2018 2:43 pm
by Mr.Dandy
Thanks for the clue.
But I don't see some parameters in ParagraphProperties.
For example, how can I reach Separator's fields to have "Lesson" and "Study notes"?
Re: Writer: modify outline numbering parameters
Posted: Mon Aug 13, 2018 11:06 pm
by sasa
Re: Writer: modify outline numbering parameters
Posted: Tue Aug 14, 2018 1:53 am
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
Re: Writer: modify outline numbering parameters
Posted: Fri Aug 17, 2018 2:49 pm
by Mr.Dandy
Thanks UnklDonald (and so Sir Pitonyak)