将Excel工作表保存在asp.net中的文件夹中 [英] Saving the excel sheet in a folder in asp.net

查看:78
本文介绍了将Excel工作表保存在asp.net中的文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的...完成导出网格视图以达到出色的效果...
现在我要做的是将excel工作簿(工作表)保存在目录文件夹中吗?

Yeah...M done with exporting grid view to excel...
Now what i am suppose to do is i need to save that excel workbook(sheet) in directory folder?

推荐答案

private void ExportGridView() 
{    
System.IO.StringWriter sw = new System.IO.StringWriter();     System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);      // Render grid view control.    
 gvFiles.RenderControl(htw);
      // Write the rendered content to a file.   
  string renderedGridView = sw.ToString(); 
    File.WriteAllText(@"C:\Path\On\Server\ExportedFile.xlsx", renderedGridView); } 


看看以下链接:
http://stackoverflow.com/questions/10411520/export-grid-view-to-excel-and-save-excel-file-to-folder [
Have a look at following link:
http://stackoverflow.com/questions/10411520/export-grid-view-to-excel-and-save-excel-file-to-folder[^]


这是您想要的吗? ?
Workbook.SaveAs .您可以使用此方法保存工作簿.
Server.MapPath .此方法为您提供虚拟目录路径.
Is this you want?
Workbook.SaveAs . This method you can use for saving the workbook.
Server.MapPath. This method gives you Virtual directory path.


这篇关于将Excel工作表保存在asp.net中的文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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