Aspose.Words应用笔记

之前某项目需要用到读取识别word内容,一开始使用 Microsoft.Office.Interop.Word类库,将word文档转化为html文档,,再读取分析html内容。
具体代码如下:

        /// 
        /// 把Word文档转化为Html文件
        /// 
        /// word完整文件名
        /// 要保存的完整html文件名
        /// 
        public  void WordToHtml(string wordFileName, string htmlFileName)
        {
   
            
            try
            {
   
                Object oMissing = System.Reflection.Missing.Value;
                _Application WordApp = new Application();
                WordApp.Visible = false;
                object filename = wordFileName;
                _Document WordDoc = WordApp.Documents.Open(ref filename, ref oMissing,
                    ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                    ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
                // 打开文件
                Type docsType = WordApp.Documents.GetType();
                // 转换格式,另存为
                Type docType = WordDoc.GetType();
                object saveFileName = htmlFileName;
                docType.InvokeMember("SaveAs", System

你可能感兴趣的:(笔记,c#,初始,C#,Aspose.Words)