XSL-FO overrides / overlaps table borders when setting background on table cell

I had a problem and I did not find a solution / workaround (although there are similar questions that were asked) to the XSL-FO problem with the cell background. We use Apache FOP 0.25 and a quick upgrade to a newer version. No other PDF processor is currently possible.

The fact is that when I set the background color in the cell, a new background fill fills the borders of the table, which are visible differently (solid value 0.5pt). I tried several ways to overcome this, but all of them lead to suboptimal results:

  • setting the border to 1pt - the border becomes visible, but has a different width depending on whether it runs on a cell with or without background color. He's obviously too fat.
  • setting borders for each cell of the table separately, which has a background color. This works, but I see the gaps between the borders that are set on cells with no background and with those. In the example below, there will be visible gaps between the vertical borders of cell 1.1 and cell 2.1, but not between 2.1 and 3.1.

    __________________________
    |cell 1.1: background    | 
    |cell 2.1: no background |
    |cell 3.1: no background |
    --------------------------
    

Are there any practical ways to solve the problem? I set the background color for the table-cell element, which should be correct, right?

Many thanks

+5
source share
1 answer

good example for borders and fill patterns that work with Apache FOP

    <fo:table border="1pt solid black">
        <fo:table-body border="inherit">
          <fo:table-row border="inherit">
            <fo:table-cell border="inherit" background-color="#F2F2F2" number-rows-spanned="2">
              <fo:block>data</fo:block>
            </fo:table-cell>
            <fo:table-cell border="inherit" background-color="#D9D9D9">
              <fo:block>data2</fo:block>
            </fo:table-cell>
          </fo:table-row>
          <fo:table-row border="inherit">
            <fo:table-cell border="inherit" background-color="#C0C0C0">
              <fo:block>data3</fo:block>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
    </fo:table>
+5
source

All Articles