asp.net 如何打开word文档模板?
我用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的那种效果实现 跪求高手指点 最好有源代码,纠结一天了 查了很多资料 没有找到好的解决办法 上面后台这种方法是可以运行 但是很麻烦
但是用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的那种效果实现 跪求高手指点 最好有源代码,纠结一天了 查了很多资料 没有找到好的解决办法 上面后台这种方法是可以运行 但是很麻烦
...全文
相关推荐
2021-2022计算机二级等级考试试题及答案No.14405.docx
2021-2022计算机二级等级考试试题及答案No.14405.docx
asp.net 利用word模板导出word文件
asp.net 利用word模板导出word文件 实例
C# ASP.NET - 将Web网页导出至Word文档
说明: 用C#实现“将Web网页导出至Word文档”^_^
asp .net 实现word文档在线预览
最近由于项目需要,特利用vs2010整理了word文档在线预览,此处主要是用office-toolswf-flexpaper实现,在此把这一功能整理成了word文档和一个小例子,希望对您有用。
ASP.NET利用DOC模板导出Word
首先创建DOC模板 再次,在项目中添加该中间页面 ReportWord.aspx 重点方法: private string PrintWord() { try { string templatePath = _SaveDocPath + "/Template/RPMB.doc";



