Free Support Forum - aspose.com

HTML Table to Docx

Hi Support,

Im running into an issue involving the conversion of a html table to a word table.

I have an example of a working table and a table that will not generate a table at all, just some tekst that is weirdly formatted.

attachment .zip

the html in attachment 1.txt added in the attachment IS working
the html in attachment 2.txt added in the attachment IS NOT working

any idea why this is the case?

Sincerely yours
Marc Roelen

@D3-ICT,

Thanks for your inquiry. You are facing the expected behavior of Aspose.Words. Please use the same table properties in both HTML files to get the desired output. Please use following table properties in attachment 2.txt.

<table width=“60%” border=“2” cellspacing=“0” cellpadding=“0” style=“color:#000000;font-family:“times new roman”;font-size:medium;”>

Thank you for your response, i’m still wondering why it is breaking. am i using properties on the table that are not allowed in aspose.words or is the table not formatted correctly?

@D3-ICT,

Thanks for your inquiry. In your document (attachment2.txt), the table’s width is 100%, border is not set and CSS class is “tioTable-0”. When you import this document into Aspose.Words’ DOM, table CSS “tioTable-0” is not found and no CSS is applied in output document. This is the reason you are getting different output from attachment1.txt.