10 Ara 2021 EPPlus Excel Tarih Formatlama Kategori: C#.NET Etiketler: ASP.NETC# 38 Yorum ExcelPackage excel = new ExcelPackage(); var workSheet = excel.Workbook.Worksheets.Add("ExcelSheet"); workSheet.TabColor = System.Drawing.Color.Black; workSheet.DefaultRowHeight = 12; //Header of table // workSheet.Row(1).Height = 20; workSheet.Row(1).Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; workSheet.Row(1).Style.Font.Bold = true; workSheet.Cells[1, 1].Value = "Tarih"; //Body of table // int recordIndex = 2; foreach (var item in data) { workSheet.Cells[recordIndex, 1].Style.Numberformat.Format = "dd.MM.yyyy"; workSheet.Cells[recordIndex, 1].Formula = string.Format("=DATE({0},{1},{2})", item.IslemTarihi.Year, item.IslemTarihi.Month, item.IslemTarihi.Day); recordIndex++; } workSheet.Column(1).AutoFit(); using (var memoryStream = new MemoryStream()) { Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment; filename=TarihOrnek.xlsx"); excel.SaveAs(memoryStream); memoryStream.WriteTo(Response.OutputStream); Response.Flush(); Response.End(); } Yorum (38) Bu yazıya henüz yorum yapılmamış... Yorum Yaz * Ad Soyad: * Email: * Message: