Ejemplo n.º 1
0
        public void CreateReport(IHistoryManager historyManager, ReportOptions reportOptions)
        {
            var dataTable = historyManager.ToDataTable();

            using (var workBook = new WorkBook())
            {
                //add new sheet where the report will be written
                workBook.insertSheets(SheetIndex.Report, 1);

                workBook.ImportDataTable(dataTable, true, 0, 0, dataTable.Rows.Count, dataTable.Columns.Count);

                for (int colIndex = 0; colIndex < dataTable.Columns.Count; colIndex++)
                {
                    workBook.setColWidthAutoSize(colIndex, true);
                }

                workBook.setSheetName(SheetIndex.Report, reportOptions.SheetName);

                ExportToExcelTask.SaveWorkbook(reportOptions.ReportFullPath, workBook);

                if (reportOptions.OpenReport)
                {
                    FileHelper.TryOpenFile(reportOptions.ReportFullPath);
                }
            }
        }
Ejemplo n.º 2
0
        public void CreateReport(IHistoryManager historyManager, ReportOptions reportOptions)
        {
            var dataTable = historyManager.ToDataTable();

            dataTable.TableName = reportOptions.SheetName;

            ExportToExcelTask.ExportDataTableToExcel(dataTable, reportOptions.ReportFullPath, true);
        }
Ejemplo n.º 3
0
 public Task ExportToExcelAsync(IEnumerable <DataTable> dataTables, string fileName, bool launchExcel = true) =>
 Task.Run(() => ExportToExcelTask.ExportDataTablesToExcel(dataTables, fileName, launchExcel));
Ejemplo n.º 4
0
 public void ExportToExcel(IEnumerable <DataTable> dataTables, string fileName, bool launchExcel = true) =>
 ExportToExcelTask.ExportDataTablesToExcel(dataTables, fileName, launchExcel);
Ejemplo n.º 5
0
 public void ExportDataTableToExcel(DataTable dataTable, string fileName, bool openExcel)
 {
     ExportToExcelTask.ExportDataTableToExcel(dataTable, fileName, openExcel);
 }
Ejemplo n.º 6
0
 public void ExportDataTablesToExcel(IEnumerable <DataTable> dataTables, string fileName, bool openExcel)
 {
     ExportToExcelTask.ExportDataTablesToExcel(dataTables, fileName, openExcel);
 }