Hi,
We are using Aspose.Cells version 22.4.0 to process Excel Workbooks of our clients. There is a special case in which Calling Workbook.Calculate() or Worksheet.Calculate functions throw and “Object reference not set to an instance of an object” exception.
I tracked down the problem to 2 subjects, 1) Circular References and 2) Iterative Calculation Option in Workbook->Options->Formulas settings. If there is a circular ref in the excel and Iterative Calc Checkbox is checked then this exception is raised!
The workbook has so many circular refs and couldn’t track down the exact problem location, I tried to recreate the problem with simpler workbook and Formula Refs, but it didn’t work out. So, I need your help to understand why I get Exception!
Furthermore, I’m passing IgnoreError = true in CalculationOptions passed to Calculate function.
Thank you
@yashar.heydari,
Thanks for details but I am afraid, without a template Excel file we might not evaluate your issue precisely and hence cannot figure it out. So, kindly do provide your template Excel file and sample code to reproduce the issue on our end, we will check it soon.
Hi Amjad,
I will share my template and
My code is pretty straight forward, I put it in here :
workbook = new Aspose.Cells.Workbook(path);
CalculationOptions calculationOptions = new CalculationOptions { IgnoreError = true };
try
{
workbook.CalculateFormula(calculationOptions);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Problem TrackDown_Final.7z (368.3 KB)
Thanks
@yashar.heydari,
Thanks for the template file.
Please notice, I am able to reproduce the issue (exception) as you mentioned by using your template file. Even if I use the following sample code, it gives an exception: “IndexOutOfRangeException: Index was outside the bounds of the array”.
e.g.
Sample code:
var workbook = new Aspose.Cells.Workbook("e:\\test2\\Problem TrackDown_Final.xlsx");
workbook.CalculateFormula();
I have logged a ticket with an id “CELLSNET-51228” for your issue. We will look into it soon.
Once we have an update on it, we will let you know.
1 Like
Thanks for prompt response.
I’ve got that exception a few times too but most of the time I get “Object Reference” exception and I pass the CalculationOptions and IgnoreError as true which may change the result
@yashar.heydari,
Thanks for providing further details.
We already noted it down and logged it into the ticket. We will evaluate your issue and figure it out soon.
1 Like
@yashar.heydari,
Your issue has been resolved now. The fix will be included in the next release (Aspose.Cells for .NET v22.6) which is scheduled in the next few days (1-3 days or so). You will also be notified when the next version is published.
1 Like
I assume Aspose.Cells for .Net will be released at the same time ?
@yashar.heydari,
Sorry, I meant Aspose.Cells for .NET. I have corrected my previous reply.
1 Like
The issues you have found earlier (filed as CELLSNET-51228) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi
The issues you have found earlier have been fixed in this update. If you have downloaded the prior one(22.6.0), please use this update to replace the downloaded one because 22.6 has a bug which sometimes may cause generated file corrupted.
1 Like