Advertisement
Guest User

DeleteAutoPageBreaks

a guest
Jul 23rd, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub DeleteAutoPageBreaks
  2. oDoc = ThisComponent
  3. oStyles = oDoc.getStyleFamilies
  4. oPageStyles = oStyles.getByName("PageStyles")
  5. oPageStyleNames() = oPageStyles.getElementNames()
  6. For i = 0 to uBound(oPageStyleNames)
  7.  thisName = oPageStyleNames(i)
  8.  oPageStyles.removeByName(thisName)
  9. Next i
  10.  oCursor = oDoc.Text.CreateTextCursor()
  11.  oCursor.GoToStart(False)
  12.    Do
  13.    If oCursor.BreakType <> com.sun.star.style.BreakType.PAGE_BEFORE Then
  14.     If NOT IsEmpty(oCursor.PageDescName) Then
  15.       oCursor.PageDescName = ""
  16.       oCursor.BreakType = com.sun.star.style.BreakType.PAGE_BEFORE
  17.     End If
  18.    End If
  19.    Loop Until NOT oCursor.gotoNextParagraph(False)
  20. Msgbox "Farite"
  21. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement