Hello,
I'm trying to solve the following task.
I have a document with mix of "usual" paragraphs and bulleted list.
What I want to make is an automatic change from bulleted list to paragraph
with a prefix.
Like
Paragraph 1
- list eement 1
- list element 2
Paragraph 2
->
Pragraph 1 (unchanged)
* list element 1 (list element 1 -> paragraph with * prefix)
* list element 2 (list element 2 -> paragraph with * prefix)
Paragraph 2 (unchanged)
Seems to be I need to write a macro for it, but all ChatGPT gave me are not
working )
Like this one
Sub ConvertBulletsToDashes()
Dim oDoc As Object
Dim oParagraphs As Object
Dim oPara As Object
Dim oText As Object
Dim i As Integer
oDoc = ThisComponent
oParagraphs = oDoc.Text.createEnumeration()
While oParagraphs.hasMoreElements()
oPara = oParagraphs.nextElement()
' Check if the paragraph is a list item
If oPara.supportsService("com.sun.star.text.Paragraph") Then
If oPara.NumberingIsNumber Then
' Get the text and replace the bullet with a dash
oText = oPara.String
oPara.String = "- " & Trim(oText)
oPara.NumberingIsNumber = False ' Remove list formatting
End If
End If
Wend
End Sub
Any hints are appreciated, thanks!
--
Best regards,
Ihor (Igor)
--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Context
- [libreoffice-users] Switching bulleted list to paragraph with prefix · Ihor Olkhovskyi
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.