3
我试图通过使用带FOP的XSL-FO生成pdf文件。XSL-FO表固定高度
我想显示一个固定高度的表格。表格可以分成几页,我希望它在每个页面上具有相同的高度。
我似乎甚至无法为单个页面上的表格定义固定高度。
我试着在桌子和桌子上设置高度,最小高度,最大高度,但似乎没有考虑到任何东西。我也尝试过使用不同的XSL-FO处理器,但没有任何运气。
小样本:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="1cm" margin-left="2cm" margin-right="2cm">
<fo:region-body margin-bottom="20mm"/>
<fo:region-after extent="10mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:table table-layout="fixed" width="100%" height="10cm" border-style="solid" border-width="0.02cm">
<fo:table-column column-width="20%"/>
<fo:table-column column-width="20%"/>
<fo:table-column column-width="60%"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>Col1</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Col2</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Col3</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
行数是否有所不同? – mzjn
是的......他们每个人的身高也是......如果他们中有破折号。 – david