A problem - maybe manual breaks not sure?

Hey folks,

Any ideas would be very appreciated…

I have a 1000 page document to edit, (Just normal text etc).
The text on each page, needs to stay on its page. i.e each page is laid out as needed…

Only thing is it needs to be columns, and when I change to columns, the number of pages decrease. So the correct text is now in the wrong place

The file is 1000 pages, I really cannot be bothered to add a break manually at the end of each page…

Is there a way to freeze the text to the page it’s on, or a way of adding Hard Page Breaks automatically?

Does anyone know please

From my perspective impossible and old typewriter approach. Pages do not exist per se and are created on demand based on text, text length, margins, footers, headers and font type, size and may be more properties of a text. And there is nothing like a “end-of-page” indicator, which could be used to insert page breaks automatically. That’s my perspective of using a word processor like LibreOffice Writer.

If your document is a set of pages and not a stream of text, a document processor like Writer is not the right tool. When your primary “object” is a page, consider DTP (desktop publishing) applications like Scribus (FLOSS) or Quark XPress (commercial).

A page-based document suggests the pages have all the same structure, e.g. they all start with a specific heading. The heading need not be the same everywhere but the fact it is a heading should be easily identified. In this case, assigning a Heading n paragraph style to this heading will do the trick: you can associate a page break to the paragraph style. A page break will occur before every such heading.

This will not guarantee that your document will always be 1000-pages long but your articles will always start a new page. If they expand, they’ll be allocated an extra page as Writer does.

To get more help, describe how your document is styled/formatted.

Hi Ajlittoz, and Opaque,

Thanks,

I hear you both, I had similar thoughts,

M/S Word calls the end of each page a Soft Page Break, but
there is no formatting code assigned to this (as far as I know so far), or that would be very helpful.

As for Headings/ styles within a page, same the only time anything useful like this exists is for new chapters.

If you can assure that your document contains only ordinary text (In specific no tables across pages!), it’s very simple to mince it to single pages: Run the code

Sub hackschnitzel()
doc = ThisComponent
cCtrl = doc.CurrentController
vc = cCtrl.ViewCursor
text = doc.Text
cCtrl.select(text.Start)
While vc.jumpToNextPage()
  vc.jumpToStartOfPage()
  tc = vc.Start
  text.insertControlCharacter(tc, 0, False)
  tp = tc.TextParagraph
  tp.PageDescName = tp.PageStyleName
Wend
End Sub  

However, I cannot see any advantages, except you want to apply page styles independently. Therefore my code doesn’t only insert hard page breaks in the positions where automatic page wrapping started a new page, but also assigns the current page style explicitly, and creates a separate PageSequence this way for every page.

Hi thanks for the reply Lupp,

The text includes numbers, no charts, just numbers and letters

Where do I put this code Lupp?

“The book” by Andrew Pitonyak will tell you.
https://www.pitonyak.org/OOME_3_0.pdf#[{“num”%3A82%2C"gen"%3A0}%2C{“name”%3A"XYZ"}%2C76.3%2C738%2C0]
Always create your modules in the Standard library if there aren’t specific reasons to do otherwise.

Ok I have an update…

I managed to run the code.

Tools > Macros > Organise macros > Basic > Standard > My Macros > Module1 > Edit

(then copy/ paste your code, and save it).

Then

Tools > Macros > Run > Organise macros > Standard > Module1 > Run

But it doesn’t have the desired effect… It doesn’t add a manual page break between each page…

Not sure if I did something wrong - it’s pretty probable :slight_smile:

I know you made it do more than that. But would you be able to give me code to just add a page break please.

Thank your for your time Lupp you are a genius by the way :slight_smile:

The code surely adds a page break a the beginning of every “soft” page.
What it does in addition, is to assign the PageStyle to the new “hard” page explicitly.
Might you be able to tell me in what way the “desired effect” was missed?
If the only thing you want differently is to not create pages with independent page styles allowed, you simply need to replace

  tp.PageDescName = tp.PageStyleName  

with

  tp.BreakType = 4  

but I doubt if this is actually the issue. Anyway, both variants work for me, and both may fail if the beginning of a new page not is inside a paragraph of the body text.

To get this clear, I would need a file with a part of the document where the code doesn’t result in the effects you want.
Do you feel sure to have understood how PageStyle and PageBreak work?

No the problem was me, I’m sorry, I made an error which is not worth time explaining.

The code works fine Lupp.

However (Sadly) the original problem was not fixed.

Changing the document to columns, after code, still decreases the page count/
and causes the text to move.

Well, this I will surely not understand without an example.I wouldn’t be surprised if a text of one page flowing full page width, split to (two?) columns did no longer fit into one page due to the distance between the columns, and to more unused space having about double the number of lines to have it wrapped to. Decreasing page count is contrary to the expected effect, and what you mean by “text to move” I don’t understand anyway. Are you sure at all, to use Writer in a reasonable way for a purpose it is reasionably suitable for? Frankly, I cannot see an appropriate approach with a document of 1000 pages, to try to make the pagination fix. What’s the reason for what you try to do so?

I would/ will make a video but first. I try to explain as concisely as possible…

Yes pages decrease. (There are reasons). Yes can use word processor OK :slight_smile:

The text on each page. Is required to stay on its page before the change to columns.

So 1- 1000 remain the same.

i.e. Page 1 (has 450 words) - Page 2 (300) - Page 3 (455)

and so on…

And then after changed to columns, each page has the same amount of words, as before (the change was made).

That’s it

What I can do is change the font size, this would be fine, but maybe this is not needed.

You may remember that I waasn’t glad about the video idea.

And OK now, I start to make a video… and everything is fine.

Your code works, The words stay on their page, Everything is fine.

Mmm, I am concerned… is the world conspiring against me?

I did however copy just one chapter, to make it quicker

I need to investigate further

I’m going to mark this question as answered.

Thank you for your help, hopefully, this info will help somebody else too.

Thank you to Lupp most of all for the code, and your time sir…

Run the code here

Tools > Macros > Organise macros > Basic > Standard > My Macros > (create) Module1 > Edit

(then copy/ paste your code, and save it). Exit/ close window.

Then

Tools > Macros > Run > Organise macros > Standard > Module1 > Run