using System;
using System.IO;
using System.Collections;
namespace Sample
{
class Test
{
static void Main(string[] args)
{
// Convert DOCX file to HTML file.
SautinSoft.UseOffice u = new SautinSoft.UseOffice();
string inpFile = Path.GetFullPath(@"..\..\example.docx");
string outFile = Path.GetFullPath(@"Result.html");
int ret = u.InitWord();
if (ret == 1)
{
Console.WriteLine("Error! Can't load MS Word library in memory");
return;
}
ret = u.ConvertFile(inpFile, outFile, SautinSoft.UseOffice.eDirection.DOCX_to_HTML);
u.CloseWord();
if (ret == 0)
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true });
}
else
Console.WriteLine("Error! Please contact with SautinSoft support:support@sautinsoft.com.");
}
}
}
UseOffice .Net allows you to convert DOCX files to HTML format efficiently. This conversion is useful for displaying Word documents in web browsers or integrating them into web applications. The component ensures that the formatting and structure of the original DOCX file are preserved in the HTML output.
The product is compatible with multiple platforms, including Windows. It supports .NET Framework 4.0 and higher, .NET Core 2.0 and higher, .NET 5.0 and higher.