C# 使用OpenXML将Word文件另存为HTML格式

C# 使用OpenXML将Word文件另存为HTML格式,c#,ms-word,openxml,C#,Ms Word,Openxml,我有一个使用Microsoft.Office.Interop.Word以HTML格式保存Word文件的代码 这是我的密码 void ConvertDocument(string fileName) { object m = System.Reflection.Missing.Value; object oldFileName = (object)fileName; object readOnly = (object)false; ApplicationClass

我有一个使用Microsoft.Office.Interop.Word以HTML格式保存Word文件的代码

这是我的密码

void ConvertDocument(string fileName)
{
    object m = System.Reflection.Missing.Value;
    object oldFileName = (object)fileName;
    object readOnly = (object)false;
    ApplicationClass ac = null;

    try
    {
        // First, create a new Microsoft.Office.Interop.Word.ApplicationClass.
        ac = new ApplicationClass();

        // Now we open the document.
        Document doc = ac.Documents.Open(ref oldFileName, ref m, ref readOnly,
            ref m, ref m, ref m, ref m, ref m, ref m, ref m,
             ref m, ref m, ref m, ref m, ref m, ref m);

        // Create a temp file to save the HTML file to. 
        tempFileName = GetTempFile("html");

        // Cast these items to object.  The methods we're calling 
        // only take object types in their method parameters. 
        object newFileName = (object)tempFileName;

        // We will be saving this file as HTML format. 
        object fileType = (object)WdSaveFormat.wdFormatHTML;

        // Save the file. 
        doc.SaveAs(ref newFileName, ref fileType,
            ref m, ref m, ref m, ref m, ref m, ref m, ref m,
            ref m, ref m, ref m, ref m, ref m, ref m, ref m);

    }
    finally
    {
        // Make sure we close the application class. 
        if (ac != null)
            ac.Quit(ref readOnly, ref m, ref m);
    }
}    

string GetTempFile(string extension)
{
    // Uses the Combine, GetTempPath, ChangeExtension, 
    // and GetRandomFile methods of Path to 
    // create a temp file of the extension we're looking for. 
    return Path.Combine(Path.GetTempPath(),
        Path.ChangeExtension(Path.GetRandomFileName(), extension));
}
我想知道如何使用OpenXML实现这一点

我在谷歌上搜索过,但没有找到相关的解决方案