[Solved] Writer: modify outline numbering parameters

Keyboard macros or custom scripts

[Solved] Writer: modify outline numbering parameters

Postby Mr.Dandy » Thu Jun 28, 2018 2:21 pm

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.3 - Windows 7
User avatar
Mr.Dandy
 
Posts: 285
Joined: Tue Dec 11, 2012 4:22 pm

Re: Writer: modify outline numbering parameters

Postby JeJe » Thu Jun 28, 2018 9:50 pm

NumberingLevel, NumberingRules etc set at the paragraph level.

https://www.openoffice.org/api/docs/com ... rties.html
Openoffice 4.1.2
Windows 8
JeJe
 
Posts: 287
Joined: Wed Mar 09, 2016 2:40 pm

Re: Writer: modify outline numbering parameters

Postby Mr.Dandy » Mon Aug 13, 2018 2:43 pm

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.3 - Windows 7
User avatar
Mr.Dandy
 
Posts: 285
Joined: Tue Dec 11, 2012 4:22 pm

Re: Writer: modify outline numbering parameters

Postby sasa » Mon Aug 13, 2018 11:06 pm

LibreOffice 5.2 on Xubuntu 16.04
sasa
 
Posts: 4
Joined: Wed Feb 08, 2017 12:54 am

Re: Writer: modify outline numbering parameters

Postby UnklDonald418 » Tue Aug 14, 2018 1:53 am

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   Expand viewCollapse view
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.5 & LibreOffice 6.1.1.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 968
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Writer: modify outline numbering parameters

Postby Mr.Dandy » Fri Aug 17, 2018 2:49 pm

Thanks UnklDonald (and so Sir Pitonyak) :bravo:
OpenOffice 4.1.3 - Windows 7
User avatar
Mr.Dandy
 
Posts: 285
Joined: Tue Dec 11, 2012 4:22 pm


Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 2 guests