LibreOffice Writer Page Break before every occurence of a word

I am using Ubuntu 14.04 and LibreOffice 4.3. I have a document with several pages. How can I give a pagebreak before every occurence of a word that begins with MHAM

Please edit your question to give more details (really edit the question, don’t use comments). Note also that LO 4.3 is an obsolete version. Current release is in the 7.4.x series, very soon 7.5.x.

A page break can occur only between paragraphs. If your paragraph begins with “MHAM”, there is a solution with Edit>Find & Replace and a specific user-created paragraph style. This means you have some knowledge about styles, haven’t you?

Your document is mostly direct formatted instead of using styles.

A style primarily does not describe the visual aspect of your text. A style tells Writer the significance or meaning of it. Styles can then be customised so that paragraph, pages or words assigned different styles look different. So, your job as an author is to think about the “components” of your document. You have title, headings, narrative and “special” paragraphs (such as list of items). The narrative for the main topic of the document is usually styled Text Body.

Because of the versatility implemented in the style machinery, Default Paragraph Style should never be used for real text because it is the ancestor of all other styles and whatever you change in it propagates down to all others. It is an effective way to define your own defaults which will give your documents a distinctive personal look.

Your “MHAM…” paragraphs look like an id (identification code). Consequently, they should receive an ad-hoc paragraph style. I create paragraph style Id for them. I configured its Text Flow to force a page break before it. In Indents & Spacing,I set a 2 cm space above so that I can remove your manual approximate vertical spacing preceding the paragraph.

I reformatted the first 3 pages in Lokadalatdt.11.02.2023_Exp-ajl.odt (154.2 KB)

To restyle everything, Edit>Find & Replace. In Find: enter “MHAM”. Press Find All. Quit the dialog. All occurrences are highlighted. Assign the Id paragraph style. You’re done.

*Final note: learn to use styles. They are your friends to automate document composition. Read the Writer Guide for an introduction.