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!
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!
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:
"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} [[page break]] es_{$itemNum<$size} es_dataInteresting
Thanks for the information! Very useful.