Page 1 of 1

XHTML Import Table Borders

PostPosted: Fri Oct 02, 2015 5:34 am
by Roil
Hello,

I have an issue I have been trying to resolve for a while, and I haven't been able to get exactly what i need. I feel like it is rather simple, and it is just something I am missing. See the example table html code that I am importing.

Code: Select all
<table width="100%" border="1" cellspacing="0">
  <tr>
    <td>Test Table Cell 1</td>
    <td>Test Table Cell 2</td>
    <td>Test Table Cell 3</td>
    <td>Test Table Cell 4</td>
  </tr>
</table>


The problem I have is that I need to provide some attribute to the table tag that will give me table the hairline borders. I am very limited in the HTML I can provide, so it has to be inline styling. The code above produces a table that looks like there is a border around the entire table, and then there are borders around each cell individually. Is there anyway to just give it a single line border on everything? Also, is there a way to pass an attribute in the HTML that will cause the table to be single lined?

See the image below. The top table is what I am trying to produce, and the bottom table is what I get in the docx from the code above. (ignore the bold and italic styling)

Image

Any help is greatly appreciated.

Re: XHTML Import Table Borders

PostPosted: Fri Oct 02, 2015 7:05 pm
by jason
It sounds like you might have CSS border-collapse:separate rather than border-collapse:collapse

See https://github.com/plutext/docx4j-Impor ... r.java#L89

Try setting border-collapse:collapse on your html table?

Re: XHTML Import Table Borders

PostPosted: Mon Oct 05, 2015 10:27 pm
by Roil
Perfect. That is exactly what I was looking for. Thanks Jason!