NullReferenceException while loading protected excel file

I am using Aspose.Cells and trying to load excel files. These are being proteced in excel but with no password. I can open these files using ClosedXml.

Using Aspose.Cells I get a NullReferenceException
Capture.PNG (40.2 KB)

I tried setting the password while loading the file on string.Empty. Unfortunately it didn’t work.
Do you have any tips for me?


Thanks for the screenshot and details.

Could you provide us your template file (you may zip it prior attaching), we will check it soon.

Unfortunately I can give you no sample. We have just recognized, this error would happen if the excel file includes a pivot table that needs to be calculated on start.
Is there any way to disable this behavior?


I am afraid, without your template file, we cannot evaluate your issue precisely to consequently figure it out. I think you may make your thread private and post your attachments, we will take care of your data and check your issue.

Well, you may skip PivotTables while loading your template file if this helps, see the following sample code for your reference:
Sample code:

var filePath = @"e:\test2\Book1.xlsx";
            var loadFilter = new LoadFilter(LoadDataFilterOptions.All & ~LoadDataFilterOptions.PivotTable);
            var asposeOptions = new Aspose.Cells.LoadOptions
                //your code goes here
                LoadFilter =  loadFilter
            var workbook = new Workbook(filePath, asposeOptions);

Hope, this helps a bit.

Yes id did help. Thanks.
I just needed to specify the load filter LoadDataFilterOptions.CellData. It resolved the problem.
Is there any variant for that on save? I am trying to save the file and I get the same exception again


I am afraid, there is no such attribute available for saving the workbook.