C# Word to HTML Conversion
Why Use C# to Convert Word to HTML
Now, most of website pages are created from HTML (Hyper Text Markup Language) files because HTML is still the main markup language for web pages. There are some professional software tools which can create HTML files. But for beginners, design the web content in Microsoft Word document and then convert to HTML is also a good solution. On the other hand, there may be a lot of Word documents that may take lots of time on one-by-one conversion. So, a solution by using programming to do Word to HTML conversion can be cool. Here I am introducing you how to use C# to do Word to HTML conversion with .NET component.
C# Word to HTML Conversion
Some .NET component for developers can do Word to HTML conversion by using C#. Spire.Doc is one of the best choices. As a professional .NET Word component, Spire.Doc can help developers perform a wide range of Word document processing tasks directly, such as generate, read, write and modify Word documents. Now, download Spire.Doc, install on your system and follow the simple steps below to convert Word to HTML.
Note: Please make sure Spire.Doc and Visual Studio are correctly installed on system.
- Step 1 Create Project
using System;
using Spire.Doc;
namespace DocToHTML
{
class Program
{
static void Main(string[] args)
{
}
}
}
- Step 2 Load Word Document
Document doc = new Document();
doc.LoadFromFile(@"..\..\Test.doc",FileFormat.Doc);
- Step 3 Save and Preview
doc.SaveToFile(@"..\..\Test.html",FileFormat.html);
System.Diagnostics.Process.Start(@"..\..\Test.html");
Now, the whole process is finished. Press F5 to start the project and an HTML file will be automatically generated.
As a professional and powerful Word component, Spire.Doc doesn't need Microsoft Office Word Automation but also allows user to directly operate Word document, format and style and insert content to Word document. Click to learn more…