How to create a border for whole table

Amit Kumar picture Amit Kumar · Sep 25, 2013 · Viewed 29.8k times · Source

I have to draw solid lines as border.

I am using this 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">

Answer

G. Ken Holman picture G. Ken Holman · Sep 25, 2013

Add the border attribute to all table-cell elements. You can see here that borders are not inherited: 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.