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

Free Support Forum - aspose.com

Opening protected workbooks not working

Hello,

I am having a problem with Aspose.Cells 4.8.0.12.

I have attached a Visual Studio 2008 console application and two .xslx files (one protected, one not protected) so you can see what is happening. The console application shows that Aspose.Cells.dll can properly handle unprotected Excel 2007 files from the file system and stream but it does not properly handle protected Excel 2007 files from a stream.

The protection I applied to the workbook is the "Protect Structure and Windows" where only the "Structure" checkbox is checked.

Please let me know if you find a solution for this, either in the Aspose component or in my sample code.

Thanks,

-Tim

Tim A. Dutcher
Altriva Solutions
Bellevue, WA

Hi Tim,

Thank you for considering Aspose.

We have found your mentioned issue after an initial test. We will look into it and get back to you soon. Your issue has been registered in our issue tracking system with issue id CELLSNET-11531.

Thank You & Best Regards,

Hi Tim,


Thank you for considering Aspose.

After further testing your issue, we think that there is some issue with your code. Please update your code as below:

MemoryStream stream = ReadFileToStream(EXCEL_FILENAME_PROTECTED);

stream.Position = 0;

FileFormatType filetype = CellsHelper.DetectFileFormat(stream);

stream.Position = 0;

workbook.Open(stream, filetype);

Please try it and let us know if you still face any problem. Also, you may try the attached latest version as we have made some changes regarding CellsHelper class in this version.

Thank You & Best Regards,

Thank you. After I applied these code changes the Aspose.Cells component properly opened the protected Excel 2007 file.

Perhaps in a future version your Workbook.Open method could auto-detect the file type of a protected Excel 2007 workbook similar to how the CellsHelper.DetectFileFormat method is doing it. Currently, you get an exception if you specify the xlsx type when trying to open a protected workbook from a stream using the Open method.

Thanks again for responding quickly with a solution.

-Tim

Tim A. Dutcher
Altriva Solutions

Thank you for version 4.8.0.12 and 4.8.013 that you made available to me.

Could you tell me whether the updates you made available are your "Net2.0" versions or "Net1.0"? We are using 4.8.0.12 at this time in Windows Server 64-bit and are seeing new errors since moving to that version from the "Net2.0" version of 4.8.0.0.

So that I am sure I have "Net2.0" of 4.8.0.12, could you zip that version for me and attach it to this forum? This will help me to know that I have the best version for Windows Server 64-bit.

Thank you,

-Tim

Tim A. Dutcher
Altriva Solutions

Hi,

Thank you for considering Aspose.

Please try the attached Aspose.Cells for 64 bit machine as per your requirement.

Thank You & Best Regards