Convert Word to EPub in C#, VB.NET

EPub is one format of electronic book to display contents with the most appropriate reading mode. Therefore, Word document is usually converted to EPub to give readers a more wonderful reading effect. This guide demonstrates a solution to convert Word to EPub in C# and VB.NET easily with Spire.Doc for .NET. The following screenshot shows the converted EPub file from Word.

Word to EPub

Spire.Doc for .NET provides a SaveToFile(String fileName, FileFormat fileFormat) method of Document class to convert Word to EPub or other document format. When invoking this method to convert Word to EPub, extension of parameter String fileName should be .epub and enum FileFormat should be chosen as EPub among options. Download and install Spire.Doc for .NET and follow the code:

[C#]
using Spire.Doc;

namespace WordtoEPUB
{
    class Epub
    {
        static void Main(string[] args)
        {
            //Load Document
            Document document = new Document();
            document.LoadFromFile(@"E:\Work\Documents\Spire.Doc for .NET.docx");
            //Convert Word to EPub
            document.SaveToFile("ToEpub.epub", FileFormat.EPub);
            System.Diagnostics.Process.Start("ToEpub.epub");
        }
    }
}
[VB.NET]
Imports Spire.Doc

Namespace WordtoEPUB
    Friend Class Epub
        Shared Sub Main(ByVal args() As String)
            'Load Document
            Dim document As New Document()
            document.LoadFromFile("E:\Work\Documents\Spire.Doc for .NET.docx")
            'Convert Word to EPub
            document.SaveToFile("ToEpub.epub", FileFormat.EPub)
            System.Diagnostics.Process.Start("ToEpub.epub")
        End Sub
    End Class
End Namespace

Spire.Doc, the professional stand-alone component to manipulate MS Word document without automation, enables developers to generate, read, write, modify Word document on their .NET, WPF and Silverlight application.