I have a simple program which converts HTML files into PDF files using Words (version 3.5.3.0). Whenever an HTML file has a table which has 1 or more “td” tags which contain a “rowspan” attribute, then the resulting table is displayed incorrectly. Specifically, all of the “td” cells on the row below the one with the cell with the “rowspan” tag (or more rows, if the rowspan value is greater than 2) are incorrectly positioned to the left by 1 column (or more, if there are more than 1 cells with rowspan attributes), and an extra “empty” cell is placed at the end of the row. It appears that when the rows following the one with the rowspan are rendered, the fact that the previous row has cells spanning into those rows is being ignored.
Here is some VB.Net code I am using to recreate the problem - it is saving to HTML format rather than PDF due to simplicity, but the results are the same:
doc = New Document(HtmlFileBefore, LoadFormat.FormatHtml, "")
doc.Save(HtmlFileAfter, SaveFormat.FormatHtml)
Here is the HTML file text (just a test file to recreate the problem):
<p>
TABLE #1 [3x2, rowspan=2]
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td rowspan="2">Row 1-2, Col 1</td>
<td>Row 1, Col 2</td>
<td>Row 1, Col 3</td>
</tr>
<tr>
<td>Row 2, Col 2</td>
<td>Row 2, Col 3</td>
</tr>
</table>
</p>
<br />
<p>
TABLE #2 [5x2, rowspan=2]
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td rowspan="2">Row 1-2, Col 1</td>
<td>Row 1, Col 2</td>
<td>Row 1, Col 3</td>
<td>Row 1, Col 4</td>
<td>Row 1, Col 5</td>
</tr>
<tr>
<td>Row 2, Col 2</td>
<td>Row 2, Col 3</td>
<td>Row 2, Col 4</td>
<td>Row 2, Col 5</td>
</tr>
</table>
</p>
<br />
<p>
TABLE #3 [3x3, rowspan=3]
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td rowspan="3">Row 1-3, Col 1</td>
<td>Row 1, Col 2</td>
<td>Row 1, Col 3</td>
</tr>
<tr>
<td>Row 2, Col 2</td>
<td>Row 2, Col 3</td>
</tr>
<tr>
<td>Row 3, Col 2</td>
<td>Row 3, Col 3</td>
</tr>
</table>
</p>
<br />
<p>
TABLE #4 [4x2, rowspan=2/rowspan=2]
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td rowspan="2">Row 1-2, Col 1</td>
<td rowspan="2">Row 1-2, Col 2</td>
<td>Row 1, Col 3</td>
<td>Row 1, Col 4</td>
</tr>
<tr>
<td>Row 2, Col 3</td>
<td>Row 2, Col 4</td>
</tr>
</table>
</p>
Thanks,
Brett