This project has moved and is read-only. For the latest updates, please go here.

Borders not appearing in table

Aug 19, 2015 at 4:56 PM
Hi,

I have an html table as part of a larger document which I am trying to convert to OpenXml.

When viewed as html, the table appears as it should with the borders all in the correct places, but after converting to OpenXml, when I view the resulting file in Word, none of the borders are visible.

A sample of the code for the table is given below (the real one has a lot more rows).
Does anyone have any idea why the borders wouldn't be appearing when it is viewed in Word?

Thank you in advance.
<table style="border-collapse: collapse;">
    <tr>
        <td style="font-weight: bold; padding: 10px;">
            Heading 1a
        </td>
        <td style="font-weight: bold; padding: 10px;">
            Heading 1b
        </td>
        <td style="font-weight: bold; padding: 10px; border-left: 1px solid #000000;">
            Heading 2a
        </td>
        <td style="font-weight: bold; padding: 10px;">
            Heading 2b
        </td>
    </tr>
    <tr>
        <td style="font-weight: bold; padding: 10px; border-top: 1px solid #000000;">
            Value 1a
        </td>
        <td style="font-weight: bold; padding: 10px; border-top: 1px solid #000000;">
            Value 1b
        </td>
        <td style="font-weight: bold; padding: 10px; border-top: 1px solid #000000; border-left: 1px solid #000000;">
            Value 2a
        </td>
        <td style="font-weight: bold; padding: 10px; border-top: 1px solid #000000;">
            Value 2b
        </td>
    </tr>
</table>
Coordinator
Aug 20, 2015 at 2:01 AM
I know the "border" attribute on a table needs the "Table Grid" style available in the Word Document, but I'm not sure about border-top or border-left.

I rely heavily on the table styles in Word to render the table borders for me rather than the style tags, but I'm fortunate in that I get to define a good portion of the HTML that I have to convert using this library.