XSLT - 块必须适合 table-cell
XSLT - Block has to fit table-cell
我的问题是基于具有两个单元格的 table。如果一个单元格中有更多文本,它会向下扩展。在那种情况下,另一个块更短(请注意 table 单元格与另一个单元格一样大)。
基本上我想在 table 单元格周围制作边框。但它应该是一个图像作为边界。我在 table 单元格中填充,内部块的背景颜色为白色。通过这种策略,它看起来有点像边界。问题是,第二个单元格中的块较小,因此它下面有更多 space。边框变得不一致。
有没有办法缩放块以适应?
单元格中包含文本的块的大小适合文本。这就是为什么你现在的背景不均匀。
您需要的是整个 table 的 background-color:table 的大小将适合最大的单元格。
如果图像在 fo:block 内,并且同一块还包含 table,您会得到想要的结果。
伪代码:
<fo:block background-image="image.png">
table goes here, with background-color="white" and a transparent border around the table to set the width/height of the visible portion of the background image.
</fo:block>
编辑:评论揭示了更多细节。
加上边框应仅围绕 table header 的附加约束:
- 定义 table 无边框。
- 在 header 个单元格中插入背景图片。
- 将 header 单元格文本放在一个块中,边距为例如各边 5 毫米。
- 对于 body 行,还要指定边距以使 body 文本与 header 文本对齐。
由于您使用的是 Antenna House,因此您可以使用 <fo:block-container column-count="2">
并在第二个 fo:block
上添加 break-before="column"
。参见 https://www.antennahouse.com/product/ahf64/ahf-ext.html#axf.column-count and https://www.w3.org/TR/xsl/#break-before
我的问题是基于具有两个单元格的 table。如果一个单元格中有更多文本,它会向下扩展。在那种情况下,另一个块更短(请注意 table 单元格与另一个单元格一样大)。
基本上我想在 table 单元格周围制作边框。但它应该是一个图像作为边界。我在 table 单元格中填充,内部块的背景颜色为白色。通过这种策略,它看起来有点像边界。问题是,第二个单元格中的块较小,因此它下面有更多 space。边框变得不一致。
有没有办法缩放块以适应?
单元格中包含文本的块的大小适合文本。这就是为什么你现在的背景不均匀。
您需要的是整个 table 的 background-color:table 的大小将适合最大的单元格。
如果图像在 fo:block 内,并且同一块还包含 table,您会得到想要的结果。
伪代码:
<fo:block background-image="image.png">
table goes here, with background-color="white" and a transparent border around the table to set the width/height of the visible portion of the background image.
</fo:block>
编辑:评论揭示了更多细节。
加上边框应仅围绕 table header 的附加约束:
- 定义 table 无边框。
- 在 header 个单元格中插入背景图片。
- 将 header 单元格文本放在一个块中,边距为例如各边 5 毫米。
- 对于 body 行,还要指定边距以使 body 文本与 header 文本对齐。
由于您使用的是 Antenna House,因此您可以使用 <fo:block-container column-count="2">
并在第二个 fo:block
上添加 break-before="column"
。参见 https://www.antennahouse.com/product/ahf64/ahf-ext.html#axf.column-count and https://www.w3.org/TR/xsl/#break-before