//这里的案例是自动生成excel
string pathstr = System.Web.HttpContext.Current.Server.MapPath("/FilePath"); if (!System.IO.Directory.Exists(pathstr)) System.IO.Directory.CreateDirectory(pathstr); string filePath = Server.MapPath("/FilePath/" + filename); FileStream file = new FileStream(filePath, FileMode.Create); xssfworkbook.Write(file); file.Close();
//重点 System.Diagnostics.Process.Start(filePath);