oCurs.NumberingRules = None

I was looking for a way to convert an unordered list into simple paragraph text using Basic and I found @mikekaganski 's macro herehttps://ask.libreoffice.org/t/numbered-list-macro/30200/5. Thank you for that, Mike.
.
However, when Option Explicit is set, it complains that the variable None is not defined. While playing around with Option Explicit disabled, I discovered that None becomes an empty variant when the statement oCurs.NumberingRules = None is executed, so I declared None as a variant and it now works as intended with Option Explicit.
.
I find the concept of clearing a property by setting it to an empty variable unusual. At least in my experience this is not common practice in VBA or VB.Net. There, it would be more common to use the keyword Nothing, or VBNullString for an empty string. Is this a common practice in LibreOffice Basic or with the LibreOffice API?

You could find there, that there was a plan to simply implement ConvertNumbersToText. I did that… why not use it?

I was actually just looking for the equivalent of the VBA (Word) method Selection.ClearFormatting (https://learn.microsoft.com/en-us/office/vba/api/word.selection.clearformatting) to clear the manually assigned list format and convert back to normal text. I don’t need the numbers. I searched a long time but didn’t find anything similar in LibreOffice. The next best thing I found was to use the oCurs.NumberingRules = None statement from your macro.

Most likely, I simply misremembered the Basic keyword name (I’m not a Basic developer, my native language is C++ :wink: ), and without Option Explicit, my invented None just worked by accident. I meant to use Nothing.

.
That’s interesting. I actually tested that too, and it doesn’t work.
.
None of the following work:

oTextCursor.NumberingRules = Nothing 
oTextCursor.NumberingRules = Null
oTextCursor.NumberingRules = ""

The only one that works is:
.
oTextCursor.NumberingRules = None (where none is an empty variant variable)
.
So I guess you stumbled across the only one that works by accident. :smiling_face:

Then it needed to be Empty, not None.

Yes, that works.

Just for the sake of completeness, was I correct that LibreOffice does not have a direct equivalent for Selection.ClearFormatting?

Is there a documentation on that Selection.ClearFormatting, so that someone who could want to answer, would be able to understand, for what there is or there is not a “direct equivalent”? we definitely have means to clear formatting - but it depends upon which formatting that is; you may want to clear direct formatting, or remove list style, or character style; or maybe you want to set paragraph style to a different one (like “Default Paragraph Style”).

Yes, here it is again.

I can do some experiments with it today to see exactly what formatting is reset.

Formatting reset / removed by Selection.ClearFormatting

Formatting type Removed
Alignment (right, middle, left) Yes (reverts to left)
Bold, italics, underline, strikethrough, subscript / superscript Yes
Borders Yes
Change case No
Highlighting No
Indentation Yes
Line and paragraph spacing Yes
List (ordered or unordered) Yes
Shading (background fill) Yes
Styles Yes (reverts to Normal style)
Text effects (outline, shadow, glow) Yes