Page 1 of 1
How to keep all entire rows together on the same page when assembling tables.
Posted: Thu Sep 09, 2021 12:08 pm
by shiney_98
How to avoid page-break in rows of the table
Re: How to keep all entire rows together on the same page when assembling tables.
Posted: Thu Sep 09, 2021 1:47 pm
by julien_lacour
Hello,
Yes, the keep-together.within-page FO attribute will help you avoiding page-breaks inside a row.
If you are using DITA documents and the DITA Map PDF - based on XSL-FO transformation on a recent version of Oxygen (which uses DITA-OT 3.x), the following style-sheet is included by default:
Code: Select all
<xsl:attribute-set name="tbody.row">
<!--Table body row-->
<xsl:attribute name="keep-together.within-page">always</xsl:attribute>
</xsl:attribute-set>
Which means that all the <fo:table-row> elements present the attribute, like this:
Code: Select all
<fo:table-row keep-together.within-page="always">
...
</fo:table-row>
Could you indicate which version of Oxygen you are currently using?
Could you also precise which input you want to transform into PDF?
Regards,
Julien
Re: How to keep all entire rows together on the same page when assembling tables.
Posted: Mon Sep 13, 2021 6:55 am
by shiney_98
Hi, thanks for the reply.
Could you indicate which version of Oxygen you are currently using?
The current version I'm using is Oxygen 23.0
Could you also precise which input you want to transform into PDF?
While assembling tables in a dita document file(topic), I want the table rows with content that could bleed into another page to stay on one page while transforming to PDF.
Re: How to keep all entire rows together on the same page when assembling tables.
Posted: Mon Sep 13, 2021 11:53 am
by shiney_98
I wanted to keep the contents of the row together on the same page while assembling tables.. I've tried using keep-together.within-page="always", keep-together.within-column="always" and keep-with-next.within.page="always" separately in <fo:table-row> but it is not showing the desired result. What should be done in-order to get the content of row together on the same page?
Re: How to keep all entire rows together on the same page when assembling tables.
Posted: Fri Sep 17, 2021 9:58 am
by julien_lacour
Hello,
As I mentioned before, in the DITA Map PDF - based on XSL-FO transformation, this attribute is automatically set by the following attribute-set (in org.dita.pdf2/cfg/fo/attrs/tables-attr.xsl):
Code: Select all
<xsl:attribute-set name="tbody.row">
<!--Table body row-->
<xsl:attribute name="keep-together.within-page">always</xsl:attribute>
</xsl:attribute-set>
If you run the default transformation you will see that the table row is moved into another page, like in this example:
table.png
Rows from table body are generated by the following template:
Code: Select all
<xsl:template match="*[contains(@class, ' topic/tbody ')]/*[contains(@class, ' topic/row ')]">
<fo:table-row xsl:use-attribute-sets="tbody.row">
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:table-row>
</xsl:template>
You can use this template as a starting point for your customization.
You can also run the transformation with the clean.temp=no parameter, you can then check the topic.fo file.
It must contain <fo:table-row keep-together.within-page="always"> for each table row.
Regards,
Julien
Re: How to keep all entire rows together on the same page when assembling tables.
Posted: Fri Sep 17, 2021 10:17 am
by shiney_98
Thanks a lot.