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

Free Support Forum - aspose.com

Fetching Pivot Tables in Excel worksheet

Hello Babar,


The code is working well on the local machine when I moved it to the test server it is giving the exception in the method ReadAndGenerateXls :
System.NullReferenceException: Object reference not set to an instance of an object.

Below is the line on which I received the exception :
Aspose.Cells.Pivot.PivotTableCollection pivotTables = sheet2.PivotTables;

Can you please give some idea why it is occurring.


Regards,
Chandrakant

Hi Chandrakant,


Thank you for contacting Aspose support.

First of all, please note that I have split the existing thread to create a new one on your behalf as it is recommended to share any distinct problem in a new thread for better visibility and tracking.

Regarding your original concerns, please check the following.

  • Does the referenced sheet2 actually contains any Pivot Tables? Before assigning it to another object please check the size of the collection.
  • Are you using same versions of Aspose.Cells for .NET API on both local and server machines?