[xep-support] XEP 3.8: Background color in table cell

Nikolai Grigoriev grig at renderx.com
Thu Jun 24 10:25:52 PDT 2004


Werner,

> The attached sample produces a result for which I have no explanation.
> It is a table with two columns and three rows. The middle row has the
> background-color set. This has the effect that a small portion of the
> cell borders is taken away. This is odd because the background is painted
> in the padding rectangle.

It looks more like a pixel rounding effect in Acrobat. If you zoom 
the PDF in, the effect seemingly diappears. Your file also prints OK. 
So my impression is that the background rectangle is correctly sized.

I admit however that the Z-order can be made a bit more friendly: one 
should draw all backgrounds first, and all borders afterwards, so that 
a background could not overlap the border of another cell. Thank you 
for the input; we will consider this as a request for improvement.

If your file is for the print, you need not care: the effect only happens
on the screen. If you are building an electronic document, then  
a simple workaround for XEP 3.8 is to specify a uniform border 
on every cell. That is, if you restyle the table this way, it would 
produce the same visual effect without the overlap problems:

<fo:table border-collapse="separate" 
          table-layout="fixed" 
          border="0.1pt solid black">
    <fo:table-body>
        <fo:table-row>
            <fo:table-cell border="0.1pt solid black"> ....
            <fo:table-cell border="0.1pt solid black"> ....
        </fo:table-row>
        <fo:table-row background-color="rgb(221, 221, 221)">
            <fo:table-cell border="0.1pt solid black"> ....
            <fo:table-cell border="0.1pt solid black"> ....
        </fo:table-row>
        <fo:table-row>
            <fo:table-cell border="0.1pt solid black"> ....
            <fo:table-cell border="0.1pt solid black"> ....
        </fo:table-row>
    </fo:table-body>
</fo:table>

Here, each cell has its own border, that is guaranteed to be drawn 
on top of the respective background. This prevents backgrounds from 
creeping into nearby cells.

Regards,
Nikolai Grigoriev
RenderX
-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



More information about the Xep-support mailing list