Ask Your Question

numbered list macro

asked 2018-01-12 10:18:53 +0200

Donatas gravatar image

updated 2018-01-12 10:21:36 +0200

I need a simple macro to convert selected autonumbered list to simple text - numbers should appear as hand-written numbers afterwards.

I found such a macro for Word:

Sub AutoNumberToText()
End Sub

but it does not work in LibreOffice. Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-01-12 15:47:38 +0200

Jim K gravatar image

updated 2018-01-15 21:10:26 +0200

Press F12 or go to Format -> Lists -> Numbered List.

The macro recorder (Tools -> Macros -> Record Macro with macro recording enabled under Tools -> Options -> Advanced) is often problematic, but it does well in this case.

document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("")
dim args1(0) as new
args1(0).Name = "On"
args1(0).Value = false
dispatcher.executeDispatch(document, ".uno:DefaultNumbering", "", 0, args1())

A more complex numbering macro using given at


Here is a macro to convert the selected numbered list to ordinary paragraphs with the label numbers.

Sub ConvertNumberedListToLabels
    oSel = ThisComponent.getCurrentController.getSelection()
    oSelEnd = oSel.getByIndex(0).getEnd()
    oCurs = ThisComponent.getText().createTextCursorByRange(oSelEnd)
    While oCurs.NumberingIsNumber = True
        labelString = oCurs.ListLabelString
        oCurs.getText().insertString(oCurs, labelString & " ", False)
        oCurs.NumberingRules = None
End Sub
edit flag offensive delete link more


I tried to add the code you posted to the macros (enclosing it in sub MacroName - end sub). All it did was remove automatic numbering.

But what I need is different. I want the automatic numbering to be turned into normal numbers – as if I have entered them using keyboard.

Donatas gravatar imageDonatas ( 2018-01-14 00:10:28 +0200 )edit

See edited answer.

Jim K gravatar imageJim K ( 2018-01-15 21:23:57 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-01-12 10:18:53 +0200

Seen: 283 times

Last updated: Jan 15 '18