xml 如何为整个表格创建边框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19006113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create a border for whole table
提问by Amit Kumar
I have to draw solid lines as border.
我必须画实线作为边框。
I am using this loc
我正在使用这个 loc
<fo:table border="solid 0.1mm black">
but it draws only surrounded lines. It is not applied to all cells and rows. Is it possible to draw solid lines as borders with minimum coding, like not setting borders for cell and rows separately as:
但它只绘制包围线。它不适用于所有单元格和行。是否可以使用最少的编码将实线绘制为边框,例如不分别为单元格和行设置边框,如下所示:
<fo:table-row border="solid 0.1mm black">
回答by G. Ken Holman
Add the borderattribute to all table-cellelements. You can see here that borders are not inherited: http://www.w3.org/TR/xsl11/#border
将border属性添加到所有table-cell元素。你可以在这里看到边框没有被继承:http: //www.w3.org/TR/xsl11/#border
While it doesn't save any typing, you could help future support of your stylesheet by using attribute sets:
虽然它不保存任何输入,但您可以通过使用属性集来帮助将来支持您的样式表:
<xsl:attribute-set name="myBorder">
<xsl:attribute name="border">solid 0.1mm black</xsl:attribute>
</xsl:attribute-set>
...
<fo:table-cell xsl:use-attribute-sets="myBorder">
...
Then, when you need to change all, you just change it in one place.
然后,当您需要更改all 时,只需在一处更改即可。

