We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Why does sheet.Shapes.UpdateSelectedValue() throw null exception?

Apparently Shapes.UpdateSelectedValue() throws a null exception in certain circumstances.
How do I mitigate this? Any solutions?

repo code:

   private void test()
            using (FileStream ms = new FileStream(@"C:\\tmp\test.xlsx", FileMode.Open))
                cells.Workbook wb = new cells.Workbook(ms);
                int activeIndex = wb.Worksheets.ActiveSheetIndex;

                cells.CalculationOptions opts = new cells.CalculationOptions();
                opts.Recursive = true;
                opts.IgnoreError = false;
                cells.Worksheet sheet = wb.Worksheets[activeIndex];
                sheet.CalculateFormula(opts, true);

                sheet.Shapes.UpdateSelectedValue();  // <-- throws null exception error

                // you can find which shape is the culprit by iterating shapes and calling UpdateSelectedValue() on each one
                foreach (var shape in sheet.Shapes)
                        if (shape.Name == "Picture 14")  // <-- this shape throws error


                    catch (Exception)

Spreadsheet file is attached.


{“Object reference not set to an instance of an object.”}
Data: {System.Collections.ListDictionaryInternal}
HResult: -2147467261
HelpLink: null
InnerException: null
Message: “Object reference not set to an instance of an object.”
Source: “Aspose.Cells”
StackTrace: " at Aspose.Cells.Charts.Chart.\u000e(Int32 \u0002)\r\n at Aspose.Cells.Drawing.ShapeCollection.\u0003 (Int32 \u0002)\r\n at Aspose.Cells.Drawing.ShapeCollection.\u0002 (Int32 \u0002)\r\n at Aspose.Cells.Drawing.ShapeCollection.\u0006(Int32 \u0002)\r\n at Aspose.Cells.Drawing.Picture.\u0002(Byte[] \u0002)\r\n at Aspose.Cells.Drawing.Shape.UpdateSelectedValue()\r\n at IE.Cloud.Common.Open

This issue is reproduced here and logged in our database for further investigation. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSNET-48545 - Exception raised while calling Shape.UpdateSelectedValue()

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

That was quick. What’s the estimated time on this fix?


We are scheduled to publish our next official release ( Aspose.Cells for .NET v21.8) before the end of this week or in the next week early. You will be notified here once the new release comes out.

Stay tuned!

The issues you have found earlier (filed as CELLSNET-48545) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao

Thank you very much.


You are welcome.