Click here to Skip to main content
15,908,634 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello everyone,
i need to convert html to docx and implement it in my application?
Regards,
Software developer
Posted
Comments
Cansid 23-Sep-15 5:05am    
You can utilize the alternative chunk feature of DOCX files in order to achieve this.
You see the DOCX documents can have a certain placeholders (called "altChunks") that enable you to reference a HTML file which you can store inside the DOCX file itself.
You can read more about this and how to achieve this with OpenXML SDK on the following link:
How to Use altChunk for Document Assembly[^]

You can also find other approaches that do not use OpenXML SDK in order to import "altChunks":
Appending HTML and RTF content to the DOCX with MadMilkman.Docx[^]
HTML as a Source for a DOCX File[^]

But note that there are some drawbacks in this, until you open a document that contains altChunk elements in MS Word it will not have a "normal" (WordprocessingML markups) content because this approach itself does not convert html but rather relies on MS Word to do the conversion at the time when opening the document.

If you need a "real" convertion than you can try the approach from this article:
Convert HTML to / from Word document in C# and VB.NET[^]
This article uses a .NET library for Word processing[^].

1 solution

If you have MS-Word 2007 or 2010, use it to open your HTML document; then save it as a docx. I'm not clear on what you mean by "implement it in my application."
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900