asp.net 如何打开word文档模板?

dyh2452819449 dyh2452819449 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我用xp的系统运行效果还可以正常的
但是用win7的系统就不行
<object id="ocx" classid="CLSID:96A2A8F4-4D76-44DD-A369-AC3C5D62BC9B" width="0" height="0"
codebase="../ActiveX/setup.exe#version=1,7,0,17">
</object>
if (ua[2].indexOf("Windows NT 5.1") != -1) {//这行是判断电脑系统
var iReturn = ocx.RunApp(vPath, 1);

} else {

//var iReturn = ocx.RunApp(vPath, 1); //win7系统的这样就不行
document.getElementById("Button3").click(); //这个我是用后台新建一个word文档下载在打开不是很好,太麻烦了
}
if (ua[2].indexOf("Windows NT 5.1") != -1) {
if (iReturn == -100) {
LG.tip("您尚未安装Office Word!");
}
}
}
//这是后台代码
protected void Button3_Click(object sender, EventArgs e)
{
Export("application/ms-word", "新建.doc");
}
private void Export(string FileType, string FileName)
{
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
Response.ContentType = FileType;
this.EnableViewState = true;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
Response.Write(tw.ToString());
Response.End();
}


我就想用xp的那种效果实现 跪求高手指点 最好有源代码,纠结一天了 查了很多资料 没有找到好的解决办法 上面后台这种方法是可以运行 但是很麻烦
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
dyh2452819449
.NET社区 62,275 成员 668,968 内容