SoFunction
Updated on 2025-04-09

Implement word document online preview function code


using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using Word = ;
public partial class test :
{
protected void Page_Load(object sender, EventArgs e)
{
WordToHtml("d:\\");
}
/// <summary>
/// Convert word to html
/// </summary>
/// <param name="wordFileName"></param>
private string WordToHtml(object wordFileName)
{
//Put the user code here to initialize the page
word = new ();
Type wordType = ();
docs = ;
//Open the file
Type docsType = ();
doc = ()("Open", , null, docs, new Object[] { wordFileName, true, true });
//Convert the format, save as
Type docType = ();
string wordSaveFileName = ();
string strSaveFileName = (0, - 3) + "html";
object saveFileName = (object)strSaveFileName;
("SaveAs", , null, doc, new object[] { saveFileName, });
("Close", , null, doc, null);
//Exit Word
("Quit", , null, word, null);
return ();
}
}