开发者

XSL-FO when setting table-cell background it overwrites / overlaps table borders

I am having an issue and have not found a solution/workaround (although there are similar questions that have been posed) to the XSL-FO problem with cell background. We are using Apache FOP 0.25 and a rapid upgrade to the newer version another PDF processor is not feasible at the moment.

The thing is that when I set background-color on a cell, the new background filling covers borders of the table that are visible otherwise (0.5pt solid). I have tried a couple of ways to overcome it, but they all lead to suboptimal results:

  • setting border to 1pt - the border becomes visible but has different widths depending upon if it runs along a cell with background-color or without. It is clearly too fat.
  • setting borders on each table-cell separately that has backg开发者_如何学Goround-color. That works but I see gaps between borders that are set on the cells without background and the ones with. In the example below there would be visible gaps between 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 workarounds to solve the issue? I am setting background-color on the table-cell element, that should be correct, right?

Many thanks


good example for borders and fill patterns which are 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜