8 replies [Last post]
HoSpiTaL_gHoSt
Offline
Joined: 2010-07-02

Hello,

I have a template with a repeating section. The amount of content of the repeating section is unknown, it can vary from half a page to several pages. What I would like to do is create a new page for each section in the list I'm looping over.

Here is a small example, with a repeating section that generates one word for each item in the list:

rs_animals
animal
es_animals

I would like each animal to be on a new page (so in this example each page would contain one word, but in my case there's more content on one page).

Possible solution 1)
I tried doing this by pressing CTRL+ENTER before the template field 'animal', which places the field 'animal' on a new page. When generating the document with several animals, each animal is generated on a new page, which is good, but the document starts with one empty page (the page which contains the field 'rs_animals' in the template!). How can I get rid of this empty page, or is there another way to do this?

Possible solution 2)
In another document I generated, I put all the content I wanted on a new page in a one-cell-table, and then edited the properties of the table:
- I unchecked "Allow table to split across pages and columns"
- I checked "Allow row to break across pages and columns"
This way each table was put on a new page, and if one table had too much content to fit on one page, the content was split to a second page, and then the next table was generated again on a new page. This was perfectly what I want (it didn't generate an empty first page), but in that case 2 tables could never fit on one page, so it always took a new page to generate the next table.
In tried this "solution" for my current problem, but this time it can occur that 2 tables do fit on one page, so then Docmosis doesn't take a new page for each table, so I can't use this technique now I think.

EDIT: The template is created in OpenOffice 3.0.0, and I'm generating PDF documents (currently on Windows Vista).

Suggestions?
Thanks in advance!

HoSpiTaL_gHoSt
Offline
Joined: 2010-07-02
Solved my own problem

I'm sorry for this post, I solved my own problem:

Because I pressed CTRL+ENTER before the field 'animal', my template looked like this (this is still just an example):

--- Page 1 ---

rs_animals

--- Page 2: ---

animal
es_animals

But I didn't see that after the field 'rs_animals', there was still an ENTER. When I removed that, my problem was solved, I'm so happy!

admin
Offline
Joined: 2010-09-06
Other Options
Hello HoSpiTaL_gHoSt. Thanks for the good diagnostics and well done solving it yourself. Another option for solving this problem is shown in example4 of the download bundle - you can "wrap" the page-break in a conditional section. The example does it like this:
rs_data
cs_notLast
[[page break]]
es_notLast
es_data
"notLast" is simply present in the data (see sample.txt) in this example. This can also be achieved using the built-in variables. For example:
rs_data
cs_{$itemnum<$size}    ** was previously incorrectly written as cs_{$itemNum<$size} (capital N) **
[[page break]]
es_{$itemnum<$size}    ** was previously incorrectly written as es_{$itemNum<$size} (capital N) ** 
es_data
HoSpiTaL_gHoSt
Offline
Joined: 2010-07-02
Interesting

Thanks for the information! Very useful.

shollaway
Offline
Joined: 2010-09-13
Hint

The code is actually:

«rs_data»
«cs_{$itemnum<$size}»
[[Page Break]]

«es_{$itemnum<$size}»
«es_data»

Note: The variable is itemnum, not itemNum - it's case sensitive.

Also I had to insert a blank line after my page break to get it to work. A nice 1pt high line works well for this.

admin
Offline
Joined: 2010-09-06
Correction noted

Hello Shollaway.

Thanks for taking the time to post the correction. I will ammend the post to indicate.

mv
Offline
Joined: 2010-12-20
Better solution

Even better solution:

At beginning of the first page (make sure it's not preceded by spaces or breaks or w/e):
<>
[[page break]]
template contents
<>

This way you can avoid the «cs_{$itemnum<$size}» ...

Regards

Matthias

mv
Offline
Joined: 2010-12-20
correction

I forgot to use the code tag...
Hopefully this is showed correctly:


<>
[[page break]]
template contents
<>

mv
Offline
Joined: 2010-12-20
gah... in between

gah...
in between brackets:

rs_data

es_data