Bladeren bron

Added constructor

Piotr Czajkowski 3 maanden geleden
bovenliggende
commit
c2dc285e33
1 gewijzigde bestanden met toevoegingen van 5 en 0 verwijderingen
  1. 5 0
      ExcelORM/ExcelORM/ExcelWriter.cs

+ 5 - 0
ExcelORM/ExcelORM/ExcelWriter.cs

@@ -14,6 +14,11 @@ public class ExcelWriter
         xlWorkbook = File.Exists(path) ? new XLWorkbook(path) : new XLWorkbook();
     }
 
+    public ExcelWriter(IXLWorkbook workbook)
+    {
+        xlWorkbook = workbook ?? throw new ArgumentNullException(nameof(workbook));
+    }
+
     private static int GenerateHeader<T>(IXLWorksheet worksheet, PropertyInfo[] properties) where T : class
     {
         var rowIndex = 1;