用户必须选择路径并保存excel文件 [英] User has to select the path and save the excel file

查看:124
本文介绍了用户必须选择路径并保存excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

保存按钮代码如下



i我直接将excel保存在D文件夹中。



for该代码如下



Save button code as follows

i am directly save the excel in D folder.

for that code as follows

System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);      
gvEmpdetails.RenderControl(htw);
string renderedGridView = sw.ToString();
File.WriteAllText("D:Employee123.xl", renderedGridView)







但我希望用户必须选择路径并保存excel。



选择路径我该怎么办



我尝试过:



保存按钮代码如下



i我直接将excel保存在D文件夹中。


该代码的
如下






but i want user has to select the path and save the excel.

for selecting path how can i do

What I have tried:

Save button code as follows

i am directly save the excel in D folder.

for that code as follows

System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);      
gvEmpdetails.RenderControl(htw);
string renderedGridView = sw.ToString();
File.WriteAllText("D:Employee123.xl", renderedGridView)







但我希望用户必须选择路径并保存excel。



用于选择路径我该怎么办




but i want user has to select the path and save the excel.

for selecting path how can i do

推荐答案

正如你上次提到这个问题时被告知的那样:如何使用C#在ASP.NET中的特定路径中保存excel [ ^ ]



As you were told the last time you asked this question: How to save excel in specific path in ASP.NET using C#[^]

ASP.NET is unable to interact with client machine folder structure, as it has only access to browser only.
that's why, When you download any file from web application it ask you for the path to store the file. You can not directly put/download file in client machine it may treat as malicious activity.


请不要重新发布



如何使用C#在ASP.NET中的特定路径中保存excel [ ^ ]
Please don't repost

How to save excel in specific path in ASP.NET using C#[^]


这篇关于用户必须选择路径并保存excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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