我有一个简单的 xsl-fo 表,显示违规行为的集合。每个违规都是表中一组 3 行。每个组的高度可以不同,某些违规属性比其他属性更大。页面上可能有数百个违规组。我正在寻找一种解决方案,在违规组中的最后一行之后对表进行分页,以便 1 个违规不会分成 2 个页面。不幸的是,当前的代码确实使表变得混乱。
我是 XSL-FO 新手,尚未尝试任何解决方案。下面是我的 FO 表。我希望我说得有道理。 我的环境是XLS 1.0
<fo:table table-layout="fixed" width="100%">
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<!--Violation Group 1-->
<fo:table-row>
<fo:table-cell><fo:block>Violation 1 Attrib 1</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 1 Attrib 2</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 1 Attrib 3</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>Violation 1 Attrib 4</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 1 Attrib 5</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 1 Attrib 6</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>Violation 1 Attrib 7</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 1 Attrib 8</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 1 Attrib 9</fo:block></fo:table-cell>
</fo:table-row>
<!--Violation Group 2 Possible Brake here if group below does not fit on the page-->
<fo:table-row>
<fo:table-cell><fo:block>Violation 2 Attrib 1</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 2 Attrib 2</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 2 Attrib 3</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>Violation 2 Attrib 4</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 2 Attrib 5</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 2 Attrib 6</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>Violation 2 Attrib 7</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 2 Attrib 8</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 2 Attrib 9</fo:block></fo:table-cell>
</fo:table-row>
<!--Violation Group 3 Possible Brake here if group below does not fit on the page-->
<fo:table-row>
<fo:table-cell><fo:block>Violation 3 Attrib 1</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 3 Attrib 2</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 3 Attrib 3</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>Violation 3 Attrib 4</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 3 Attrib 5</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 3 Attrib 6</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>Violation 3 Attrib 7</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 3 Attrib 8</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Violation 3 Attrib 9</fo:block></fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
将
keep-with-next.within-page="always"
(或 keep-with-next.within-column="always"
)添加到违规组中的前两个 fo:table-row
。