首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

word转换为HTML,本地测试可以,请教放服务器下为什么无法使用

2012-09-10 
word转换为HTML,本地测试可以,请问放服务器上为什么无法使用C# code public void wordchangetohtml(string

word转换为HTML,本地测试可以,请问放服务器上为什么无法使用

C# code
 public void wordchangetohtml(string sourcepath, string htmlpath)    {        try        {            Word.ApplicationClass word = new Word.ApplicationClass();            Type wordType = word.GetType();            Word.Documents docs = word.Documents;            // 打开文件            Type docsType = docs.GetType();            object fileName = sourcepath;            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 = htmlpath;            ///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);        }        catch (Exception EX)        {            throw EX;        }    }


 <identity impersonate="true" userName="administrator" password="1"/>这个我已经设置了!

[解决办法]
你这些相关的Wrod类所依赖的底层组件在服务器上是否有安装
就好像你本地装了word能打开word文件,但服务器没有安装word,你把word文件传到服务器,想在服务器端打开,你觉得能打开吗?

热点排行