| View previous topic :: View next topic |
| Author |
Message |
newlearner General User

Joined: 21 Sep 2010 Posts: 28
|
Posted: Tue May 08, 2012 8:25 am Post subject: Adding Paragraph style to Outline Numbering |
|
|
Hi,
I used Andrew Pitonyak's openoffice macros and was able to configure outline numbering
I was able to edit character style, Numbering style. I want to add `Paragraph style` as well.
I want the each level to have corresponding Parastyle as HeadingX
like Level 1 with Paragraph style Heading1, Level 2 Heading 2 and soon
| Code: |
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, StartWith, 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 "ParagraphStyle"
' val = "Heading" & i
' oProp.Value = "Heading" & i
Case "HeadingStyleName"
' val = "Heading" & i
' oProp.Value = "Heading" & i
Case "NumberingType"
oProp.Value = com.sun.star.style.NumberingType.ARABIC
Case "ParentNumbering"
oProp.Value = i + 1
Case "Prefix"
oProp.Value = ""
Case "Suffix"
oProp.Value = "."
'Case "CharStyleName"
' oProp.Value =
End Select
oRule(j) = oProp
Next
oRules.replaceByIndex(i, oRule())
Next
End Sub
|
The commented paragraph style lines n the code are my trails to add paragraph styles to the levels.
I was able to add custom Headings to the levels with other code in which custom styles can be passed in as array to add to outline numbering.
How can I add these Paragraph styles and not custom styles?
Any help is appreciated..
Regards,
Newlearner |
|
| Back to top |
|
 |
DVezina OOo Advocate

Joined: 29 Sep 2006 Posts: 248 Location: Orlando
|
Posted: Tue May 08, 2012 10:02 am Post subject: |
|
|
You were close.
The property name that equates to Paragraph Style in the window is "HeadingStyleName".
However, you must make sure that the style you are applying exists. In your tests, you were assigning "Heading0", "Heading1", which don't exist so it looked like it wasn't working.
| Code: |
Case "HeadingStyleName"
oProp.Value = "Heading " & (i+1)
|
|
|
| Back to top |
|
 |
newlearner General User

Joined: 21 Sep 2010 Posts: 28
|
Posted: Tue May 08, 2012 10:56 am Post subject: |
|
|
Hi,
Thank you very much, it works. I should have checked that i starts from 0.
Newlearner |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|