0

I use opentbs to generate lists in word documents. Is it possible to add a page break after x rows in a table?

I hope you can help me. If you need further information feel free to ask.

1 Answers1

0

The solution is to use conditional sections in your block that is defined on the table row.

The first section has to be a row with a page break and a conditional display for each x rows (see under). The second section has to be a copy of first row but without the page break and which is set as the default section.

Here is an example with a page break on each 5 rows (x=5):

In the cell with the parameter when [...]=0 you have to go in the paragraph properties and set the option page break before to checked.

Table :

|-----------------------------------------------------------|------|
| Column 1                                                  | col2 |
|-----------------------------------------------------------|------|
| [b.nom;block=tbs:row;when [b.#;ope=nif:1,add:-1,mod:5]=0] |      |
|-----------------------------------------------------------|------|
| [b.nom;block=tbs:row;default]                             |      |
|-----------------------------------------------------------|------|

Explanation for the expression [b.#;ope=nif:1,add:-1,mod:5]=0:

  • [b.#] is a field that displays the row number (first is number 1)
  • parameter ope=... will make serial computing on the value of the field.
  • ope=mod:5 would make row #1 to be 1, row #5 to be 0...
  • ope=add:-1,mod:5 would make row #1 to be 0, row #5 to be 4...
  • ope=nif:1,add:-1,mod:5 will do the same except for row #1. So the page break does not occurs for the first row.

So at the end, the expression is true for each 5 rows except for the first one.

Skrol29
  • 5,402
  • 1
  • 20
  • 25
  • i tried your solution, but in libre office i cant set page breakbefore option for a table row? Or do i have to change something in my ods file? i use a simple table. – tablesuplex Jul 07 '17 at 07:32
  • It seems that forced page-break are not allowed in tables in ODT files. – Skrol29 Jul 07 '17 at 13:16