200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > InvokeMember打开Word文档另存为Html页如何先关闭Html再退出Word ?【HTML】

InvokeMember打开Word文档另存为Html页如何先关闭Html再退出Word ?【HTML】

时间:2023-01-30 11:10:55

相关推荐

InvokeMember打开Word文档另存为Html页如何先关闭Html再退出Word ?【HTML】

web前端|html教程

InvokeMember打开Word文档另存为Html页如何先关闭Html再退出Word ?

web前端-html教程

public partial class CountyTown : System.Web.UI.Page

{

public string countyName = string.Empty; //乡镇名称

public string documentFullName = string.Empty; //预案全称(包括后缀名)

public string documentName = string.Empty; //预案名称

房地产网站源码程序,ubuntu桌面卡顿,tomcat9下载官网,吾爱破解 爬虫视频,php的扩展gmp有什么用,香港seo网站lzw

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

try

{

//根据传递过来的乡镇名称获取到文件名称

countyName = Request[“space”];

documentFullName = “江谭乡防台风和山洪灾害防治预案.docx”;

documentName = documentFullName.Substring(0,documentFullName.LastIndexOf(‘.’));

}

catch (Exception)

{

documentFullName = “”;

}

}

// 在此处放置用户代码以初始化页面

协同源码,vscode 安装c环境,ubuntu qt全屏,tomcat上的jdk,sqlite3 qt5,怎么通过爬虫破解电子书籍,php 文件夹是否存在,广东seo搜索优化平台,获取网站缩略图,dreamweaver个人模板下载lzw

Application word = new Application();

Type wordType = word.GetType();

Documents docs = word.Documents; // 打开文件

Type docsType = docs.GetType();

object fileName = Server.MapPath(@”~\UpLoad\”) + documentFullName;

Document doc = (Document)docsType.InvokeMember(“Open”,BindingFlags.InvokeMethod,null, docs,new Object[]{fileName, true, true }); // 转换格式,另存为

比特币的开源码谁编的,vscode高端指南,ubuntu拨号软件最新绿色版,啥叫tomcat,sqlite读列信息,qq 第三方插件下载地址,怎样快速学完前端框架,爬虫的专业英语,php 数组 获取键,seo专区论坛,同学录 网站模板,易语言制作网页,合作社网站模板lzw

Type docType = doc.GetType();

object saveFileName = Server.MapPath(@”\UpLoad\”) +documentName + “.html”;

//string j=”text/javascript”;

ClientScript.RegisterClientScriptBlock(GetType(), “”, “<!–alert(\" + saveFileName.ToString() + ")");

// –>”);

//保存HTML(报错:Word 无法保存此文件,因为它已在别处打开。)

docType.InvokeMember(“SaveAs”,BindingFlags.InvokeMethod, null, doc, new object[] {

saveFileName, WdSaveFormat.wdFormatHTML });

// 退出 Word

wordType.InvokeMember(“Quit”,BindingFlags.InvokeMethod, null, word, null);

Response.Redirect(“~/Upload/” + documentName + “.html”);

}

回复讨论(解决方案)

你本地测试不要打开word文档,将打开的word文档关闭掉。

没有打开word文档?

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。