Ejemplo n.º 1
0
 private static void SaveToExcelFile(Dictionary <string, object>[] rows, string filePath, string bindingFilePath)
 {
     using (var package = new ExcelPackage(new FileInfo(filePath)))
     {
         var workbookBinding = new WorkbookBinding(XDocument.Load(bindingFilePath));
         PopulateWorkbook(rows, package.Workbook, workbookBinding);
         package.Save();
     }
 }
Ejemplo n.º 2
0
 private static void PopulateWorkbook(Dictionary <string, object>[] rows, ExcelWorkbook workbook, WorkbookBinding workbookBinding)
 {
     foreach (var worksheetBinding in workbookBinding.Worksheets)
     {
         var worksheet = workbook.Worksheets[worksheetBinding.Name];
         if (worksheet != null)
         {
             PopulateWorksheet(rows, worksheet, worksheetBinding);
         }
     }
 }