private void XuatBBGioKoDungQuyDinh_Va_DiTreVesom(object sender, WaitWindowEventArgs e) { string saveFileName = (string)e.Arguments[0]; using (var p = new ExcelPackage()) { //2. xuat bb bang ChiTietVaoTreRaSom #region ghi sheet bang ChiTietVaoTreRaSom p.Workbook.Worksheets.Add("ChiTietVaoTreRaSom"); var ws = p.Workbook.Worksheets["ChiTietVaoTreRaSom"]; ws.Name = "ChiTietVaoTreRaSom"; //Setting Sheet's name XL.ExportSheetTreSom(ws, m_dsnv); #endregion #region ghi sheet bang ChiTietVaoTreRaSom p.Workbook.Worksheets.Add("ThieuChamCong_KhongNhanDienCa"); ws = p.Workbook.Worksheets["ThieuChamCong_KhongNhanDienCa"]; ws.Name = "ThieuChamCong_KhongNhanDienCa"; //Setting Sheet's name XL.ExportSheetThieuChamCong_KhongHieuCa(ws, m_dsnv); #endregion Byte[] bytes = p.GetAsByteArray(); XL.XuatFileExcel(saveFileName, bytes, "frmXuatBBCongPC_XuatBBGioKoDungQuyDinh_Va_DiTreVesom"); } }