Two Lines of Key Code to Convert Word to HTML with C#

Megan00
Posted by Megan00 under HTML 5 category on | Points: 40 | Views : 2391
Below code can help you convert word to html with C# via a Word Component with two lines of key code:
C#
using Spire.Doc;
using Spire.Doc.Documents;
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
document.LoadFromFile(@"..\..\..\..\..\..\Data\FindAndReplace.doc");
//Save doc files
document.SaveToFile("Sample.html", FileFormat.Html);
//Launching the MS Word file.
WordDocViewer("Sample.html");
}
private void WordDocViewer(string fileName)
{
try
{
System.Diagnostics.Process.Start(fileName);
}
catch { }
}

Comments or Responses

Posted by: Srilu.Nayini577 on: 8/14/2012 Level:Starter | Status: [Member] | Points: 10
Nice post.I also working on this topic.


Thank you,

Login to post response