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

Qcontriver Qcontriver 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

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"/>这个我已经设置了!
...全文

相关推荐

亲测,以html形式显示或预览word,excel,pdf,txt

本源码主要是ASP.net后台通过相应的类把word\excel\pdf\txt文件转化为html,将地址传回前端,前端获取地址,用iframe进行展现预览。

思念小刀

ASP实现本地Excel、Word转HTML并入库操作指南

Active Server Pages(ASP)是一种服务器端脚本环境,允许开发者使用VBScript或JavaScript等语言来创建动态网页。ASP运行在服务器上,当用户请求一个ASP页面时,服务器执行脚本代码,并将结果(通常是HTML)发送到客户端浏览器。这使得开发者能够创建包含动态内容的网页,并与数据库和其它服务器端对象交互。COM(Component Object Model,组件对象模型)是微软推出的一种用于软件组件之间进行交互的二进制接口标准。

腾讯天美工作室群

Android将word(doc、docx)转换成html

将word(doc、docx)转换成html 然后可以调用网页控件将其显示出来

斯达-苍狼王

java+poi实现word转换html兼容03和07

java+poi实现word转换html兼容03和07,可以直接用于项目中,当做工具类使用,添加部分注释,自己也是在网上做了很多功课整理出来的,血汗分

文艺青年

巧用Java程序把Word转换成Html文件

Jacob是Java和Windows下的Com桥,通过它我们可以在Java程序中调用COM组件。如果你的JDK是1.4,那你需要下载Jacob1.9的jni库才能正常运行,早期版本在JDK1.4下有些问题。

gw617
评论 3
收藏 已收藏
分享
返回顶部
Qcontriver
Web 开发 81,107 成员 341,720 内容