Reputation: 1
I use different page layouts for different pages (first/rest) and would like the table to use all available space after a page break. Is there a way to control this in xsl:fo?
Since I use table-headers and optional table-footers to have headers/footers printed on all pages, I can't split the table manually, or at least not to my knowledge, otherwise I would have output each row in a separate fo:table as a workaround, to let the renderer know that the parent container has a different size after the page break.
For the FO -> PDF conversion I use FOP v2.10
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master page-width="210mm" page-height="297mm" margin="5mm 12mm 5mm 12mm" master-name="A4-PORTRAIT-FIRST">
<fo:region-body margin="30mm 23mm 28mm 3mm"/>
<fo:region-end extent="20mm" background-color="red" />
</fo:simple-page-master>
<fo:simple-page-master page-width="210mm" page-height="297mm" margin="5mm 12mm 5mm 12mm" master-name="A4-PORTRAIT-REST">
<fo:region-body margin="30mm 3mm 11mm 3mm"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="A4-PORTRAIT">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="A4-PORTRAIT-FIRST" page-position="first"/>
<fo:conditional-page-master-reference master-reference="A4-PORTRAIT-REST" page-position="rest"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
......
<fo:flow flow-name="xsl-region-body">
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="20%"/>
<fo:table-column column-width="20%"/>
<fo:table-column column-width="20%"/>
<fo:table-column column-width="20%"/>
<fo:table-column column-width="20%"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block font-weight="bold">DATA1</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block font-weight="bold">DATA2</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block font-weight="bold">DATA3</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block font-weight="bold">DATA4</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block font-weight="bold">DATA5</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row keep-together.within-page="always">
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block>LOREM</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block>IPSUM</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block>DOLOR</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block>SIT</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block>AMET</fo:block>
</fo:table-cell>
</fo:table-row>
....
</fo:table-body>
</fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="20%" />
<fo:table-column column-width="20%" />
<fo:table-column column-width="20%" />
<fo:table-column column-width="20%" />
<fo:table-column column-width="20%" />
<fo:table-body>
<fo:table-row keep-together.within-page="always">
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block>LOREM</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block>IPSUM</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block>DOLOR</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block>SIT</fo:block>
</fo:table-cell>
<fo:table-cell padding="0.5mm" border="solid 1px black">
<fo:block>AMET</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
Full-Example: Source code
Upvotes: 0
Views: 33