using (var package = new ExcelPackage()) { var workbook = package.Workbook; //*** Sheet 1 var worksheet = workbook.Worksheets.Add("Sheet1"); worksheet.Cells["A1"].Value = "ThaiCreate.Com"; worksheet.Cells["B2"].Value = "2017"; package.SaveAs(new FileInfo(Server.MapPath(@"Xls/myExcel.xlsx"))); }
using (var package = new ExcelPackage()) { var workbook = package.Workbook; //*** Sheet 1 var worksheet = workbook.Worksheets.Add("Sheet1"); worksheet.Cells["A1"].Value = "ThaiCreate.Com"; worksheet.Cells["B2"].Value = "2017"; //*** Sheet 2 var worksheet2 = workbook.Worksheets.Add("Sheet2"); worksheet2.Cells["C2"].Value = "ThaiCreate.Com"; worksheet2.Cells["D3"].Value = "2017"; package.SaveAs(new FileInfo(Server.MapPath(@"Xls/myExcel.xlsx"))); }
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท