当前位置:编程学习 > C#/ASP.NET >>

asp.net 将word转换成html 问题

Word.ApplicationClass word = new Word.ApplicationClass();
                            Type wordType = word.GetType();
                            Word.Documents docs = word.Documents;

                            // 打开文件
                            Type docsType = docs.GetType();
                            object fileName = "E:\\Project\\www.erp.com\\Web\\Resume\\"+ strCondition;//"E:\\web\\Resume\\" + strCondition;
                   
                            Word.Document doc = (Word.Document)docsType.InvokeMember("Open",
                            System.Reflection.BindingFlags.InvokeMethod, null, docs, new Object[] { fileName, true, true });

                            // 转换格式,另存为
                            Type docType = doc.GetType();
                            object saveFileName = "E:\\Project\\www.erp.com\\Web\\Resume\\" + dr["Chr_Name"].ToString() + Convert.ToDateTime(dr["Chr_SendTime"]).ToString("yyyyMMddhhmmss") + ".html";
                            //下面是Microsoft Word 9 Object Library的写法,如果是10,可能写成:
                            /*
                            docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,
                             null, doc, new object[]{saveFileName, Word.WdSaveFormat.wdFormatFilteredHTML});
                            */
                            ///其它格式:
                            ///wdFormatHTML
                            ///wdFormatDocument
                            ///wdFormatDOSText
                            ///wdFormatDOSTextLineBreaks
                            ///wdFormatEncodedText
                            ///wdFormatRTF
                            ///wdFormatTemplate
                            ///wdFormatText
                            ///wdFormatTextLineBreaks
                            ///wdFormatUnicodeText
                            docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,
                             null, doc, new object[] { saveFileName, Word.WdSaveFormat.wdFormatHTML });

                            // 退出 Word
                            wordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod,
                             null, word, null);

上面代码是在Page_Load执行的,没发布之前,没有任何问题,发布到本地的iis5.1上就在页面就一直读进度条了!大家谁写过类似的经验,给点想法,还有就是com那个权限我已经改了! --------------------编程问答-------------------- 没人??? --------------------编程问答-------------------- .....求高手
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,