Learn how to convert Word documents to EPUB in C#: https://blog.aspose.com/2021/12/01/convert-a-word-to-epub-in-csharp/
Last active
December 1, 2021 07:13
-
-
Save aspose-com-gists/195c44f2a6821422b11f5fa3211977c5 to your computer and use it in GitHub Desktop.
Convert Word Documents to EPUB in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the Word document | |
Document doc = new Document("document.docx"); | |
// Create an object for save options | |
HtmlSaveOptions saveOptions = new HtmlSaveOptions(); | |
// Set the desired encoding | |
saveOptions.Encoding = Encoding.UTF8; | |
// Specify at what elements to split the internal HTML at. This creates a new HTML within the EPUB | |
// which allows you to limit the size of each HTML part. This is useful for readers which cannot read | |
// HTML files greater than a certain size e.g 300kb. | |
saveOptions.DocumentSplitCriteria = DocumentSplitCriteria.HeadingParagraph; | |
// Enable export of document properties | |
saveOptions.ExportDocumentProperties = true; | |
// Specify save format | |
saveOptions.SaveFormat = SaveFormat.Epub; | |
// Convert Word document to EPUB | |
doc.Save("word-to-epub.epub", saveOptions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the Word document | |
Document doc = new Document("document.docx"); | |
// Convert Word document to EPUB | |
doc.Save("word-to-epub.epub"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment