I can't for the life of me solve this issue I've been struggling with for the last couple of days.
I'm performing a DB query and filling the result set into a DataTable. After that I populate a worksheet with the data with the help of the Cells[].LoadFromDataTable method.
Upon saving the workbook with the ExcelPackage.SaveAs(Stream OutputStream) method, I'm getting the following exception:
```
ArgumentNullException: Value cannot be null.
Parameter name: key
```
This error comes from the internals of EPPlus and it's pretty cryptic so I have no idea how to continue. At first I thought it was because of null values in my data but I changed them and still got the error.
Stack trace:
> at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at OfficeOpenXml.ExcelWorksheet.UpdateRowCellData(StreamWriter sw)
at OfficeOpenXml.ExcelWorksheet.SaveXml(Stream stream)
at OfficeOpenXml.ExcelWorksheet.SaveHandler(ZipOutputStream stream, CompressionLevel compressionLevel, String fileName)
at OfficeOpenXml.Packaging.ZipPackagePart.WriteZip(ZipOutputStream os)
at OfficeOpenXml.Packaging.ZipPackage.Save(Stream stream)
at OfficeOpenXml.ExcelPackage.Save()
at OfficeOpenXml.ExcelPackage.SaveAs(Stream OutputStream)
Error occurrs because EPPlus attempts to fetch a Dictionary key that is null (which is not allowed) but I have no idea in which context it tries to do so. Can anyone guide me in the right direction?
I'm performing a DB query and filling the result set into a DataTable. After that I populate a worksheet with the data with the help of the Cells[].LoadFromDataTable method.
Upon saving the workbook with the ExcelPackage.SaveAs(Stream OutputStream) method, I'm getting the following exception:
```
ArgumentNullException: Value cannot be null.
Parameter name: key
```
This error comes from the internals of EPPlus and it's pretty cryptic so I have no idea how to continue. At first I thought it was because of null values in my data but I changed them and still got the error.
Stack trace:
> at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at OfficeOpenXml.ExcelWorksheet.UpdateRowCellData(StreamWriter sw)
at OfficeOpenXml.ExcelWorksheet.SaveXml(Stream stream)
at OfficeOpenXml.ExcelWorksheet.SaveHandler(ZipOutputStream stream, CompressionLevel compressionLevel, String fileName)
at OfficeOpenXml.Packaging.ZipPackagePart.WriteZip(ZipOutputStream os)
at OfficeOpenXml.Packaging.ZipPackage.Save(Stream stream)
at OfficeOpenXml.ExcelPackage.Save()
at OfficeOpenXml.ExcelPackage.SaveAs(Stream OutputStream)
Error occurrs because EPPlus attempts to fetch a Dictionary key that is null (which is not allowed) but I have no idea in which context it tries to do so. Can anyone guide me in the right direction?