Convert HTML to DOCX – Aspose.HTML Cloud SDK

The document formats DOCX and DOC can contain a wide range of data, including text, tables, raster and vector graphics, video, sounds and diagrams. These formats are very popular because of the variety of options they offer users to write any type of documents. DOCX/DOC documents support a wide range of formatting features. Sometimes, they are not always the best choice for distributing as they can be easily modified without the author’s approval.

The DOCX file format is one of the most widely used. Converting HTML to DOCX allows you to take advantage of Microsoft Word’s rich editing capabilities, making it easier to collaborate and share content in a familiar and widely used format.

Aspose.HTML Cloud produces quick and easy way to convert HTML to DOCX. This article explains in a set of code examples how to convert an HTML file to DOC/DOCX using available SDKs and REST API.

HTML to DOCX Conversion

Aspose.HTML Cloud SDK allows you to fetch an HTML document from storage location by its name, from a URL or a local file on your drive, convert it to a specified format and save it to the storage or a local drive. The following code examples demonstrate how to convert HTML to DOCX/DOC for different cases using available SDKs and REST API.

Example 1. Convert HTML to DOCX with default save options

Let’s look at an example of converting a local HTML file to DOCX and saving the result to a local path.

HTML to DOCX conversion occurs with the default conversion options: the resulting DOCX document’s width and height correspond to A4, and all margins have zero value.

Example 2. Convert a Web page to DOCX

Aspose.HTML Cloud allows you to retrieve an HTML page from the web by its URL, convert it to another format, and save it to the local file system. The example below demonstrates how to convert a web page to DOCX with the default conversion parameters.

HTML to DOCX conversion occurs with the default conversion options: the resulting DOCX document’s width and height correspond to A4, and all margins have zero value.

Example 3. Convert HTML to DOCX inside cloud storage

Aspose.HTML Cloud allows you to retrieve an HTML file from cloud storage and save the conversion result back to cloud storage. Let’s look at an example of conversion within the cloud storge with default saving options.

See Also