Html table header is not correct


Hi Aspose,
I had this scenario where I try to insert an HTML table inside a DOCX table and the table header is not correct.
This is the template used (XPENG-83.DOCX) and the html String used (html.txt) (12.9 KB)

Here is the code used to reproduce this problem.

final Document doc = new Document("/Users/hugofreixo/Documents/tests/XPENG-83.DOCX");
final DocumentBuilder builder = new DocumentBuilder(doc);

builder.insertHtml(html, true);"/Users/hugofreixo/Documents/tests/result.docx");

I use the Java version of Aspose Words 18.10 but I tested this with Aspose Words 19.6 and the same problem occurs.

Best regards,
Hugo Freixo



We have tested the scenario using the latest version of Aspose.Words for Java 19.7 and have not found any issue with output. Please check the attached output document. output (11.2 KB)

Could you please share the issue that you are facing with the output document? We will then provide you more information about your query.


Hi @tahir.manzoor,

I opened the generated file and the problem is there. The error is in the table Header. It seems that it is not aligned correctly. Some text is not even visible.

This is what the header should show
image.png (161.6 KB)

When I open your output document, this is the result:
image.png (89.4 KB)

Best regards,
Hugo Freixo



Please use the DocumentBuilder.InsertHtml (String) method as shown below to get the desired output.



Hi @tahir.manzoor,
If I used builder.insertHtml(html); or builder.insertHtml(html, false); the table is correct but the table style changes. I believe the same problem is happening to the table content with Aspose Words 17.7 (but now it’s fixed).

Don’t you think this is a fixable bug?
Best regards,
Hugo Freixo



It is nice to hear from you that your problem has been solved.

We are investigating this case and will get back to you soon.



We have logged this problem in our issue tracking system as WORDSNET-18885. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.