I’m running into issues with the Word to HTML conversion with a table present. A Border Width defined at 0.5 points does not render properly.
I’ve attached a document here with 2 tables. The first is a table with a Border Width that is by default set at ½ (0.5) points. The second identical but set to 0.75 points.
When this gets rendered to html, it is converted literally, so the css that is applied to the cell will be 0.5pt and 0.75 respectively for the two tables. This is problematic because the 0.5pt is too small and renders nothing at my default zoom level (If I zoom the text, I will see the border). Please see resulting_html.txt for the generated html for this conversion. Save it as an HTML file to see how it will look in Chrome, FF, IE… You can also look at resulting_html_render.png to see what my output is.
Investigating this further…
When I look at the document manually, I wanted to and get all the way down to the Table’s Cell level and look at the CellFormat.Borders property
Aspose.Words.Document doc = new Aspose.Words.Document("C:/aspose_errors/border_testing.docx");
NodeCollection nodes = doc.GetChildNodes(NodeType.Table, true);
foreach(Node node in nodes)
{
Aspose.Words.Tables.Table table = node as Aspose.Words.Tables.Table;
foreach(Aspose.Words.Tables.Row row in table.Rows)
{
foreach(Aspose.Words.Tables.Cell cell in row.Cells)
{
foreach(Aspose.Words.Border border in cell.CellFormat.Borders)
{
// **First table has a border.LineWidth of 0.0 when it parses through here**
// Second table has a border.LineWidth of 0.75 when it parses through here
}
}
}
}
The first table has a border.LineWidth of 0.0! I’m not sure if you have some failsafes in your code that actual translate the line width to a minimum of 0.5 or not, do you?
That aside though, if the 0.5pt is coming through is there a way in which I can tell the save process to use em or px instead of pt? I can of course manually parse the final html result manually to adjust the pt to em (or px).