打开保存Excel文件的DialogBox [英] Open Save DialogBox For Excel File

查看:190
本文介绍了打开保存Excel文件的DialogBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...



-asp.net 4.0

-Web应用



i我在创建excel后创建一个excel文件我想允许打开弹出窗口,以便用户可以在任何位置保存生成的excel我正在尝试下面的代码在我的应用程序上运行但是相同的代码,当我在我的服务器上运行它不显示保存对话框。



允许我的系统中已启用pop,所以问题是什么。和想法...



请指导我解决这个问题



hi...

-asp.net 4.0
-Web application

i am creating an excel file after creating excel i want to allow to open popup so user can save that generated excel on any location i am try Below code that run on my application but same code when i run on my server it not display save dialog box.

allow pop is already enable in my system so whats the problem. and idea about this...

please guide me for solve this issue

String FileName = "csharp_Excel.xls";
                String FilePath = "C:\\csharp_Excel.xls";
                System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
                response.ClearContent();
                response.Clear();
                response.ContentType = "text/plain";
                response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");
                response.TransmitFile(FilePath);
                response.Flush();
                response.End();

推荐答案

我没有使用 TransmitFile 此前。删除/评论 Flush()&再试一次。



查看此

在ASP.NET中使用另存为对话框下载文件 [ ^ ]

和替代方式

下载文件 - 强制文件下载对话框 [ ^ ]
I didn't use TransmitFile herebefore. Remove/Comment the Flush() & try again.

Check this
Downloading a File with a Save As Dialog in ASP.NET[^]
and alternate way
Downloading Files - Forcing the File Download Dialog[^]


这篇关于打开保存Excel文件的DialogBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆