将生成的excel文件保存在网站C#的任何文件夹中 [英] Save genrated excel file in any folder in website C#
本文介绍了将生成的excel文件保存在网站C#的任何文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我生成excel表格数据库并将其保存在任何文件夹上。
请帮我保存任何文件夹上的excel表格。
我尝试过:
i generate excel form database and save it on any folder.
please help me for save excel sheet on any folder.
What I have tried:
string pathsave = Server.MapPath("Upload/ExcelDataVendor/") xlWorkSheetToExport.SaveAs(pathsave + dt.Rows[0]["Name"].ToString() + ".xlsx");
推荐答案
Server.MapPath仅在文件夹位于您的Web空间时才有效,对于其他文件夹,您只需知道它们是什么并对其路径进行硬编码。如果您实际上希望将文件保存在客户端文件系统上,或者将客户端下载到特定文件夹,则根本无法执行此操作。
Server.MapPath only works if the folder is in your web space, for other folders you'll just need to know what they are and hard-code their path. If you are actually looking to save the file on the client file system, or to make the client download to a specific folder then you can't do that at all.
这篇关于将生成的excel文件保存在网站C#的任何文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文