I am using Ubuntu 22.04 and LibreOffice 24.8.4.2. With the help of Chat GPT I get following code
Sub DeleteFirstLineOnEachPageExceptFirst()
Dim oDoc As Object
Dim oViewCursor As Object
Dim oText As Object
Dim oPageCursor As Object
Dim i As Integer
Dim totalPages As Integer
' Get the active document
oDoc = ThisComponent
oViewCursor = oDoc.CurrentController.getViewCursor()
oText = oDoc.Text
' Create a page cursor to move between pages
oPageCursor = oDoc.Text.createTextCursorByRange(oText.Start)
' Count the total number of pages
totalPages = oDoc.CurrentController.PageCount
' Move to the second page
For i = 2 To totalPages
' Move to the start of the page
oPageCursor.gotoPage(i)
' Move to the first paragraph of the page
oViewCursor.gotoRange(oPageCursor, False)
oViewCursor.gotoStartOfParagraph(False)
oViewCursor.gotoEndOfParagraph(True)
' Delete the selected first line
oViewCursor.String = ""
Next i
End Sub
But it is giving error on line
oPageCursor.gotoPage(i)
I don’t have knowledge of any programming language. Can anybody suggest a solution for this.
I want to delete the first dashed line on every page in the given document.
Civil 01-04-2024.odt (42.9 KB)