public void CreateXls(List <BagiShuDto> Data, string FilePath) { try { var slDocument = new SLDocument(); SLPageSettings ps = new SLPageSettings(); ps.Orientation = OrientationValues.Landscape; ps.ScalePage(50); ps.PaperSize = SLPaperSizeValues.FolioPaper; ps.LeftMargin = 0; ps.RightMargin = 0; slDocument.SetPageSettings(ps); //title slDocument.SetCellValue(1, 1, "Detail SHU Koperasi Polowijo Karya Abadi"); slDocument.MergeWorksheetCells(1, 1, 1, 9); slDocument.SetCellValue(2, 1, "Periode " + _intTahun); slDocument.MergeWorksheetCells(2, 1, 2, 9); total_shu.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(3, 1, "Total SHU = Rp. " + total_shu.Text); })); DanaCadangan.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(4, 1, "Dana Cadangan (30%) = Rp. " + DanaCadangan.Text); })); JasaModal.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(4, 4, "Jasa Modal (20%) = Rp. " + JasaModal.Text); })); JasaAnggota.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(5, 1, "Jasa Anggota (10%) = Rp. " + JasaAnggota.Text); })); PengurusPengawas.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(5, 4, "Dana Pengawas (10%) = Rp. " + PengurusPengawas.Text); })); KesejahteraanPegawai.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(6, 1, "Kesejahteraan Pegawai (10%) = Rp. " + KesejahteraanPegawai.Text); })); Pendidikan.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(6, 4, "Pendidikan (10%) = Rp. " + Pendidikan.Text); })); DanaSosial.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(7, 1, "Dana Sosial (10%) = Rp. " + DanaSosial.Text); })); total_simpanan.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(8, 1, "Total Simpanan = Rp. " + total_simpanan.Text); })); total_pinjaman.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(8, 4, "Total Piutang = Rp. " + total_pinjaman.Text); })); total_belanja.Dispatcher.BeginInvoke(new Action(() => { slDocument.SetCellValue(9, 1, "Total Penjualan = Rp. " + total_belanja.Text); })); //create style SLStyle valueStyle = slDocument.CreateStyle(); valueStyle.SetHorizontalAlignment(HorizontalAlignmentValues.Center); valueStyle.Font.Bold = true; valueStyle.Font.FontSize = 16; slDocument.SetCellStyle(1, 1, 2, 1, valueStyle); //create header slDocument = CreateHeaderExcel(slDocument); //create data slDocument = CreateDataExcel(slDocument, Data); var FullPath = FilePath; if (System.IO.File.Exists(FullPath)) { System.IO.File.Delete(FullPath); } slDocument.SaveAs(FullPath); } catch (Exception) { Dialog_Loading.Close(); throw; } }
public void CreateXls(List <IptAnggotaDto> Data, string FilePath) { try { var slDocument = new SLDocument(); SLPageSettings ps = new SLPageSettings(); ps.Orientation = OrientationValues.Landscape; ps.ScalePage(50); ps.PaperSize = SLPaperSizeValues.FolioPaper; ps.LeftMargin = 0; ps.RightMargin = 0; slDocument.SetPageSettings(ps); //title slDocument.SetCellValue(1, 1, "Detail SHU Koperasi Polowijo Karya Abadi"); slDocument.MergeWorksheetCells(1, 1, 1, 9); slDocument.SetCellValue(2, 1, "Periode 2020"); slDocument.MergeWorksheetCells(2, 1, 2, 9); //create style SLStyle valueStyle = slDocument.CreateStyle(); valueStyle.SetHorizontalAlignment(HorizontalAlignmentValues.Center); valueStyle.Font.Bold = true; valueStyle.Font.FontSize = 16; slDocument.SetCellStyle(1, 1, 2, 1, valueStyle); //create header slDocument = CreateHeaderExcel(slDocument); //create data slDocument = CreateDataExcel(slDocument, Data); var FullPath = FilePath; if (System.IO.File.Exists(FullPath)) { System.IO.File.Delete(FullPath); } slDocument.SaveAs(FullPath); } catch (Exception) { Dialog_Loading.Close(); throw; } }