Wanted: Macro for removing Page Breaks in MailMerge docs

Hi,

when producing MailMerge text documents, semi-automatic Page Breaks are
inserted which can only be removed manually one by one, but not "all together"
by e.g. selecting the whole document (Ctrl+A) and removing Page Breaks in the
Format Paragraph dialog.

XML shows that paragraphs with page breaks are different from paragraphs
without page breaks, they bear the name "P4":

<text:p text:style-name="P4"...

In the automatic styles section, P4 has the following property:

<style:style style:name="P4" ...
      <style:paragraph-properties style:page-number="1"/>...

which - I suppose - is responsible for the page break before this paragraph.

Questions:
- Can anybody tell me, why in these "automatic" type styles the page break
cannot be removed with Strg+A but only one by one?
- Can anybody give me a hint how to write a Macro which removes those page
breaks? (If it's possible at all - in Spreadsheets there seems to be a
function which does a similar job[1], but the described problem might need a
bit more sophisticated proceeding).

Thanks,
Nino
[1] http://user.services.openoffice.org/en/forum/viewtopic.php?f=45&t=41794

Am 01.05.2012 22:25, Nino Novak wrote:

Hi,

when producing MailMerge text documents, semi-automatic Page Breaks are
inserted which can only be removed manually one by one, but not "all together"
by e.g. selecting the whole document (Ctrl+A) and removing Page Breaks in the
Format Paragraph dialog.

XML shows that paragraphs with page breaks are different from paragraphs
without page breaks, they bear the name "P4":

Drag your table or query from the data source window into the document. Choose to import text fields. There won't be any page breaks.

I do not see how to achieve the desired result by mere dragging.

E.g. with the included database Biblio, I can create the following Template:

Am 01.05.2012 23:19, Nino Novak wrote:

I do not see how to achieve the desired result by mere dragging.

E.g. with the included database Biblio, I can create the following Template:

Well, you drag the desired row set into the new document.
http://extensions.services.openoffice.org/project/AltSearch can search page breaks.

Am 01.05.2012 23:19, Nino Novak wrote:
> I do not see how to achieve the desired result by mere dragging.

> E.g. with the included database Biblio, I can create the following

Template:

Well, you drag the desired row set into the new document.

?

As said, I want a formatted output, and this cannot be achieved by mere
dragging as there is text in between and different font styles are used.

http://extensions.services.openoffice.org/project/AltSearch can search
page breaks.

Just tried. It says, "29 page breaks replaced" but they are still there, and
you can rerun the search with the same result over and over.

Any other ideas?

Nino

Hi Nino

I haven't tried this, but from reading the earlier email - the page
break is injected with the use of a style, yes? Can't you just edit the
style "P4" I think it was, so it doesn't create a page break?

Like I said, I didn't try, but that is what I would do first.

//drew

Hi Drew,

Hi Nino

I haven't tried this, but from reading the earlier email - the page
break is injected with the use of a style, yes? Can't you just edit the
style "P4" I think it was, so it doesn't create a page break?

Good thought.

However, I don't know how to alter this special style from the UI. It does not
show up in the styles dialog. Seems to be some special style type. The
mentioned style info is kept in the <office:automatic-styles> section in the
content.xml, whatever this means.

Regards,
Nino

LO documents are zipped files. Change the extension of the file
from .odt to .zip. Then unzip it. The zipped file contains some files
and some folders; one of these files is content.xml. It can be edited
with an text editor. Search for <office:automatic-styles> in the text
editor. Without having an odt file with a page break in it, I can not
make any further comments.

--Dan

AndrewMacro.odt

Read section "7.8.1 Removing Page Breaks"

Although a page break is added by "changing" styles, this is not a function of the style itself, so merely editing a style will not do this for you.

Bingo!

Thanks, Andrew - I knew there must be some magic that "just works" :wink:

Nino

Dan,

that's exactly what I did (hence the detailed info in my first mail). But no
chance to alter the page breaks from the UI.

Thanks to all who replied!!!

Good night,
Nino

Your welcome, glad it worked.

If you are looking to have more than one record on a page, look into the <next record> command
Writer automatically assumes next record = next page when merging.

Adding <next record> after last field entered, begins repeat of fields on same page.

From menu <Insert><fields><other>, select "next record".

Suppose you have a set of fields. F1, F2 and F3 in a table. Add F1, F2 and F3 on every table row.
At the end of each row in the table, add <next record> field after F3.

Hope this helps

Thanks, Paul.

However, my question has been answered by Andrew yesterday. Unfortunately I
did not change the subject line, so I'm doing it now for clarification.

Cheers
Nino