Hi there!
First, thank you for your hard work and ongoing support! After fiddling with OOXML myself "manually" for about a month and compiling numerous helper functions I really, really appreciate your effort ;-)
Now I've stumbled upon a rather complex array formula that works fine in Excel 2010 but throws a null reference exception on save() using ClosedXml.
In German this array formula looks like
```
=TEILERGEBNIS(9;INDIREKT("B02:B"&MAX(WENN(ISTLEER(#BEZUG!:B);"";ZEILE(B:B)))))
```
and results in
```
System.NullReferenceException: Object reference not set to an instance of an object.
at ClosedXML.Excel.XLWorkbook.GenerateWorksheetPartContent(WorksheetPart worksheetPart, XLWorksheet xlWorksheet, SaveContext context) in ...\ClosedXML\Excel\XLWorkbook_Save.cs:line 4096
at ClosedXML.Excel.XLWorkbook.CreateParts(SpreadsheetDocument document) in ...\ClosedXML\ClosedXML\Excel\XLWorkbook_Save.cs:line 189
at ClosedXML.Excel.XLWorkbook.CreatePackage(String filePath) in ...\ClosedXML\Excel\XLWorkbook_Save.cs:line 91
at ClosedXML.Excel.XLWorkbook.Save() in ...\ClosedXML\Excel\XLWorkbook.cs:line 413
```
upon save().
Thanks for your help and best regards,
Thomas
Comments: ** Comment from web user: MDeLeon **
First, thank you for your hard work and ongoing support! After fiddling with OOXML myself "manually" for about a month and compiling numerous helper functions I really, really appreciate your effort ;-)
Now I've stumbled upon a rather complex array formula that works fine in Excel 2010 but throws a null reference exception on save() using ClosedXml.
In German this array formula looks like
```
=TEILERGEBNIS(9;INDIREKT("B02:B"&MAX(WENN(ISTLEER(#BEZUG!:B);"";ZEILE(B:B)))))
```
and results in
```
System.NullReferenceException: Object reference not set to an instance of an object.
at ClosedXML.Excel.XLWorkbook.GenerateWorksheetPartContent(WorksheetPart worksheetPart, XLWorksheet xlWorksheet, SaveContext context) in ...\ClosedXML\Excel\XLWorkbook_Save.cs:line 4096
at ClosedXML.Excel.XLWorkbook.CreateParts(SpreadsheetDocument document) in ...\ClosedXML\ClosedXML\Excel\XLWorkbook_Save.cs:line 189
at ClosedXML.Excel.XLWorkbook.CreatePackage(String filePath) in ...\ClosedXML\Excel\XLWorkbook_Save.cs:line 91
at ClosedXML.Excel.XLWorkbook.Save() in ...\ClosedXML\Excel\XLWorkbook.cs:line 413
```
upon save().
Thanks for your help and best regards,
Thomas
Comments: ** Comment from web user: MDeLeon **
Pick up the latest source code.
This was a tough one to decide. With the way I parse the formulas it wasn't possible for me to retain the bad formula after save. So I had to decide whether to remove the offending formula or to let the program throw an exception. I decided it was best to prevent the exception and just remove the bad formula.
Manuel