Back to Devexpress

How to: Convert an HTML Document to DOCX Format

officefileapi-119052-word-processing-document-api-examples-document-conversion-how-to-convert-an-html-document-to-docx-format.md

latest1.8 KB
Original Source

How to: Convert an HTML Document to DOCX Format

  • Sep 19, 2023

The following code example shows how to convert an HTML document to the DOCX format using the RichEditDocumentServer.

View Example

csharp
server.LoadDocument("Documents\\TextWithImages.htm");
server.SaveDocument("Document_DOCX.docx", DocumentFormat.Docx);
System.Diagnostics.Process.Start("Document_DOCX.docx");
vb
server.LoadDocument("Documents\TextWithImages.htm")
server.SaveDocument("Document_DOCX.docx", DocumentFormat.Docx)
System.Diagnostics.Process.Start("Document_DOCX.docx")

Note

Implement the IUriProvider descendant and override the IUriProvider.CreateCssUri or IUriProvider.CreateImageUri method to manage decoding external contents in an HTML file. It executes your method instead of the default one when the RichEditDocumentServer needs to load data from a specific URI. Refer to the How to: Retain the Image URI in HTML Document topic for details.

See Also

Use Word Processing Document API to Load HTML Files or Export Documents to HTML