Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string strPath = Constant.GetCustomerAtStore;
- string strFileName = Server.MapPath(strPath);
- if (!File.Exists(strFileName))
- {
- SiteMaster.ET = "Không tìm thấy file " + strFileName;
- return;
- }
- strFileName = MKTDBO.CreateExcel_GetCustomerAtStore(strFileName, MKTDTO);
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- private void SaveFileExcel(string strFileName)
- {
- try
- {
- //Save file dialog trong thư mục download
- FileInfo file = new FileInfo(strFileName);
- long sz = file.Length;
- Response.ClearContent();
- Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
- Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}", System.IO.Path.GetFileName(strFileName)));
- Response.AddHeader("Content-Length", sz.ToString("F0"));
- Response.TransmitFile(strFileName);
- // Response.End();
- HttpContext.Current.ApplicationInstance.CompleteRequest();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- finally {
- SiteMaster.ET = "SUCCESS!!";//show string
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement