Procurement Consulting

Need to convert HTML to word document, which product should I buy? Is there any relevant product conversion documentation?

@chenj Aspose.Words is the right product for HTML to Word conversion. Please see our documentation to learn what formats are supported:
Code to convert the document is pretty simple:

Document doc = new Document("C:\\Temp\\in.html");"C:\\Temp\\out.docx");

Before purchase you can request a temporary 30-days license to test Aspose.Words without evaluation version limitations.

When using aspose word for java, when converting html to a word document, the complete page can be displayed on the html preview interface as shown in attachment 1. When converted to word, it will be displayed incompletely as shown in attachment 2. What is wrong? ? How to solve it? thanks

@chenj Could you please attach your input and output documents here for testing? We will check the issue and provide you more information.

I uploaded the original file html picture 1111file:///C:/Users/Administrator/Documents/WXWork/1688850808191304/Cache/File/2023-01/testhtml.html, and the converted word document picture 2222222.docx (11.4 KB)
, please help to check, thank you

@chenj Could you please zip and attach your original HTML document here for testing? From what I see in the output Word document, it looks like the table is simply too wide to fit the page. You can change page orientation to fix this for this particular document:

Document doc = new Document("C:\\Temp\\in.docx");

Or you can autofit the tables in the document to window:

Document doc = new Document("C:\\Temp\\in.docx");

Iterable<Table> tables = doc.getChildNodes(NodeType.TABLE, true);
for (Table t : tables) {

I uploaded the compressed file of the original file html, please check it. (481 Bytes)

@chenj Thank you for additional information. The problem is exactly as I have described above - the table is too wide to fit the page. So you can use once of the above suggested workarounds to get the desired output.

By the way, if convert your HTML to Word using MS Word the table also goes beyond the page bounds: ms.docx (12.8 KB)