日期:2014-05-18  浏览次数:20464 次

IO建立文件!
怎么在点击按钮的时候弹出对话框,让用户自己选择存放文件的路径,对IO不熟悉,B/S的,高手赐教!用哪个方法,没分了!原谅!
我现在导出excel,可以导出文件,当时文件路径是固定的,在别人机器上酒没法导出,必须建立文件夹,而且必须更改文件夹属性

------解决方案--------------------
FileInfo file = new FileInfo(path);
if (Directory.Exists(strFilePath) == false)
{
Directory.CreateDirectory(strFilePath);
}
xlsheet.Export(strPathFileName, OWC11.SheetExportActionEnum.ssExportActionNone, OWC11.SheetExportFormat.ssExportXMLSpreadsheet);
Response.Clear();
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader( "Content-Disposition ", "attachment; filename= " + Server.UrlEncode(file.Name));
Response.AddHeader( "Content-Length ", file.Length.ToString());
Response.ContentType = "application/ms-excel ";
Response.WriteFile(file.FullName);
file = null;