Page 1 of 1

Remove all page breaks to prepare for ebook

Posted: Sat Mar 30, 2019 6:06 pm
by robinschweitzer
Hi is there a way on open office 4.1.5 to remove all page breaks from a document? I have a document converted from pdf that I want to read on an ereader. Hence it needs to flow without any interruptions. I have looked on online and found advice for just remove page breaks from one page only, and that didn't work. Where the document has been split into pages there is also a paragraph break, which it would be great to get rid off automatically for the entire document, without removing all the paragraph breaks.
I really look forward to any advice. I have spent hours trying to figure this out myself! :D

Re: remove all page breaks to prepare for ebook

Posted: Sat Mar 30, 2019 7:55 pm
by John_Ha
robinschweitzer wrote:Hi is there a way on open office 4.1.5 to remove all page breaks from a document?
Yes :D

Manually :(

At the first location on a new page immediately after a page break (note the coloured line above showing the page break) press Backspace.

If you still have problems please upload a small file showing the problem so that it can be analysed. Use the Upload attachment tab below where you type (128 kB max); or use a file share site, Dropbox or Google Drive for a larger file.

Re: remove all page breaks to prepare for ebook

Posted: Sat Mar 30, 2019 8:09 pm
by RoryOF
AltSearch extension will remove Manual page breaks, but it may be quicker to hand edit the file, as AltSearch syntax can be tricky.

Re: remove all page breaks to prepare for ebook

Posted: Sat Mar 30, 2019 9:01 pm
by musikai
If nothing else helps then here is a Macro from Andrew Pitonyak's "AndrewMacro.odt", section "7.8.1 Removing Page Breaks":
He writes:
I have not thoroughly researched this, but I have done a few experiments. Setting the
PageDescName causes a page break. It is also possible that the BreakType is set. The
following macro detects and removes page breaks. I have only performed minimal testing. I
have not concerned myself with new page offsets.
Find and remove page breaks:

Code: Select all

Sub FindPageBreaks
  REM Author: Andrew Pitonyak
  Dim iCnt As Long
  Dim oCursor as Variant
  Dim oText As Variant
  Dim s As String

  oText = ThisComponent.Text
  oCursor = oText.CreateTextCursor()
  oCursor.GoToStart(False)
  Do
    If NOT oCursor.gotoEndOfParagraph(True) Then Exit Do
    iCnt = iCnt + 1
    If NOT IsEmpty(oCursor.PageDescName) Then
      s = s & "Paragraph " & iCnt & " has a new page to style " & _
               oCursor.PageDescName & CHR$(10)
      oCursor.PageDescName = ""
    End If
    If oCursor.BreakType <> com.sun.star.style.BreakType.NONE Then
      s = s & "Paragraph " & iCnt & " has a page break" & CHR$(10)
      oCursor.BreakType = com.sun.star.style.BreakType.NONE
    End If
  Loop Until NOT oCursor.gotoNextParagraph(False)
  MsgBox s  
End Sub

Re: remove all page breaks to prepare for ebook

Posted: Sun May 05, 2019 4:17 pm
by pietvo
RoryOF wrote:AltSearch extension will remove Manual page breaks, but it may be quicker to hand edit the file, as AltSearch syntax can be tricky.
It is not hard with AltSearch. In the Search box from Regular choose Manual page break (\m), or type the \m yourself, but don't forget to tick Regular Expressions. The tricky thing is in the Replace box you have to select Dissolve manual page or column break (\r). Then Replace all does the work.