Remove all page breaks to prepare for ebook

Discuss the word processor
Locked
robinschweitzer
Posts: 1
Joined: Sat Mar 30, 2019 6:00 pm

Remove all page breaks to prepare for ebook

Post 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
Open office 4.1.5 on windows 10
John_Ha
Volunteer
Posts: 9600
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: remove all page breaks to prepare for ebook

Post 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.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
RoryOF
Moderator
Posts: 35104
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: remove all page breaks to prepare for ebook

Post 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.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
musikai
Volunteer
Posts: 294
Joined: Wed Nov 11, 2015 12:19 am

Re: remove all page breaks to prepare for ebook

Post 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
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
pietvo
Posts: 3
Joined: Sun Mar 15, 2015 8:30 pm
Location: Utrecht

Re: remove all page breaks to prepare for ebook

Post 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.
OpenOffice 4.0.1 on MacOS X 10.10
Locked