Page break inside XSL-FO table
I have an XSL-FO stylesheet for a table.
<fo:page-sequence master-reference="defaultPage">
<fo:flow flow-name="xsl-region-body">
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="9pt"/>
<fo:table-column column-width="30pt"/>
<fo:table-column column-width="150pt"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block><xsl:text>Column 1</xsl:text></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:text>Column 2</xsl:text></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:text>Column 3</xsl:text></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<xsl:apply-templates select="rbrOcjena"/>
<xsl:apply-templates select="sifPred"/>
<xsl:apply-templates select="nazPred"/>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
There can be many rows in a table, so I would like to split it on a new page when it comes to the end when generating the PDF. Also, I would like to repeat the table title on a new page if possible. What attributes should I put in the table tag to make it this way?
Thank!
source to share
There can be many rows in a table, so I would like to split it on a new page when it comes to the end of the current one
Without seeing the XSL-FO code, it's hard to answer. Please show it. But usually this is done with sticks and breaks. For example:
<fo:table-row keep-together.within-page="always">
I would like to repeat the table header on a new page if possible. What attributes should I put in the table tag to make it this way?
Setting the XSL-FO processor to repeat a series of lines at the top of each page is not done with the attribute fo:table
. Instead, the lines to be repeated are placed inside fo:table-header
:
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<!--Block and text content-->
</fo:table-cell>
</fo:table-row>
</fo:table-header>
Then, by default, the processor should repeat header lines after a page break. This is because the attribute is omit-header-at-break
fo:table
set to "false" by default .
The most obvious reason for this is that it is immediately clear which lines belong to the title and therefore need to be repeated. If it was a link only in an attribute fo:table
, it would be more difficult to identify multiple lines as a title. You will find the relevant portion of the XSL specification here .
source to share