Writer, Basic: How to get the numbering label of a paragraph

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
aharnack
Posts: 32
Joined: Mon Jun 02, 2008 8:26 pm

Writer, Basic: How to get the numbering label of a paragraph

Post by aharnack »

Writer: How to get the numbering label of a paragraph from within an OpenOffice Basic macro?

I'm iterating through the paragraphs of a Writer document and search for list numbering by checking for numbering rules and then possible outline numbering, i.e. something like:

Code: Select all

	oParaEnum = ThisComponent.getText().createEnumeration()
	Do While oParaEnum.hasMoreElements()
		oPara = oParaEnum.nextElement()
		If oPara.supportsService("com.sun.star.text.Paragraph") Then
			If Not isEmpty(oPara.NumberingRules) Then
				If Not oPara.NumberingRules.NumberingIsOutline Then
					REM handle list item
					...
				End If
			End If
		End If
	Loop
Is there a way to retrieve from within that loop the label the list item will get? It seems possible to get the bullet char code for a bullet list or prefix and suffix of the number in case of a numbered list, but not the number itself, neither as integer value nor formatted as string of the appropriate type (arabic, roman, letter etc.) nor the complete label (prefix+number+suffix).

I noticed the label is part of the String property, but I only want the label. (OK, I guess I could iterate through the text content, assemble a text content string and subtract that from the one I get by getString(), but somehow I'm hoping to find a simpler way.)

Any ideas?

Thanks,
Andreas

OpenOffice 2.4 on Windows XP
OpenOffice 2.3 on Suse 10.3
j.kornelsn
Posts: 14
Joined: Wed Oct 06, 2010 6:26 am

Re: Writer, Basic: How to get the numbering label of a parag

Post by j.kornelsn »

From my answer at
https://ask.libreoffice.org/en/question ... -id-142895:

Code: Select all

oCurs.ListLabelString
LO / AOO on Ubuntu / Windows
Post Reply