CellsException: A workbook must contain at least a visible worksheet

Hi Aspose Team,


When I try to upload a password protected excel in my application it gives following exception.


CellsException: A workbook must contain at least a visible worksheet.


My application has following lines of code:


objwork = new Aspose.Cells.Workbook(filepath, loadOptions);

objwork.Decrypt(password);

objwork.Protect(Aspose.Cells.ProtectionType.None, password);

objwork.Save(FilePath); //The exception is caught when the code execution reaches this line


Kindly look into the matter.

Thanks,

VED



Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please provide us your source input file which is giving this error to look into this issue. We will investigate this issue and update you asap.

Please find attached the input excel.

Password : 123

Hi,

Thanks for your posting and using Aspose.Cells.

Please download and try the latest version: Aspose.Cells
for .NET v7.4.3.2
. It works fine. We have tested your file with the latest version and found no issue. Please see the sample test code below. We have also attached the output xlsx file for your reference.

C#


string filepath = @“F:\Shak-Data-RW\Downloads\excel_password_testing.xlsx”;

string password = “123”;

Aspose.Cells.LoadOptions loadOptions = new Aspose.Cells.LoadOptions();

loadOptions.Password = password;


Workbook objwork = new Aspose.Cells.Workbook(filepath, loadOptions);


objwork.Decrypt(password);


objwork.Protect(Aspose.Cells.ProtectionType.None, password);


objwork.Save(filepath + “.out.xlsx”);