Insert HTML Table String with Styles (CSS) in Word Document & Convert to PDF File using Java

I have an HTML string that is rendered using DocumentBuilder of Aspose.Words in Java. The HTML has a table that has some CSS applied to it but after converting this HTML to PDF, the tables styles are not applied. I am attaching the expected vs obtained result screenshots for your reference.

Please provide a solution. Thanks.

ExpectedResult.png (11.2 KB)
AsposeResult.png (18.0 KB)

Want to add one more thing that I am using insertHtml() method to insert an HTML table i.e. without using the builder formatting.

builder.insertHtml(html);

@mussab,

Please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • A simplified HTML string or file that you are inserting in Word document
  • Aspose.Words for Java 20.9 generated output DOCX and PDF files showing the undesired behavior

As soon as you get these pieces of information ready, we will start further investigation into your particular scenario/issue and provide you more information.