This short guide explains how to convert Word DOC to EPUB using C#. It includes details on setting the development environment, a list of steps, and sample code for developing a Word document to EPUB converter using C#. The guide also shares details on customizing the output EPUB file by setting various properties exposed by the API.
Steps to Convert DOCX to EPUB using C#
- Set the environment to use Aspose.Words for .NET to create an Ebook
- Load the source Word file into a Document object for converting to EPUB
- Create an object of the HtmlSaveOptions class for customizing the output
- Set the EPUB properties
- Save the output EPUB file using the above options
These steps cover the details of changing the file format from DOC to EPUB using C#. Load the source Word file, create an instance of the HtmlSaveOptions class and set the desired properties such as SaveFormat, flag to export document properties, and document split criteria. Then, save the output EPUB file on the disk using the HtmlSaveOptions object.
Code to Convert DOC to EPUB using C#
This code has demonstrated the DOCX to EPUB conversion using C#. The HtmlSaveOptions class contains various properties for instance AllowNegativeIndent for normalizing the negative indents, split criteria such as page break, column break, or section break, encoding, and export list labels. The DocumentSplitCriteria produces multiple files based on the criteria such as using the HeadingParagraph, each paragraph is rendered to a separate EPUB.
This article has taught us the conversion from DOC to EPUB. To convert an HTML file to a Word file, refer to the article on how to convert HTML to Word document using C#.