We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Workbook protection

Thread ID:





75864 Aug 12,2008 01:21 PM UTC Sep 4,2008 01:25 PM UTC WinForms 3
Tags: XlsIO
Administrator [Syncfusion]
Asked On August 12, 2008 01:21 PM UTC

When I try to open some Excel file in Read Mode only (for example: application.Workbooks.OpenReadOnly("d:\\temp\\test.xls");), which is protected as Book Protection (in Excel see the menu Tools->Protection->Protect Workbook...), but not protected as Document Protection (see Tools->Options->choose the "Security" Tab and input some password in the "Password for open" field), I have an exception (see below). Why is it happen, if I open file in read mode only? I've tried to use other combination of "Open" method, but it fails.

P.S. Password was not specified in the "Security" tab. Password was specified in the "Protect Workbook..." dialog only.

The exception:

System.ArgumentException: Workbook is protected and password wasn't specified.

в Syncfusion.XlsIO.Implementation.WorkbookImpl.CreateDecryptor(String password, FilePassRecord filePass)
в Syncfusion.XlsIO.Implementation.WorkbookImpl.Parse(BiffReader reader, ExcelParseOptions options, String password)
в Syncfusion.XlsIO.Implementation.WorkbookImpl.ParseStgStream(StgStream stream, ExcelParseOptions options, String password)
в Syncfusion.XlsIO.Implementation.WorkbookImpl..ctor(IApplication application, Object parent, String strFileName, ExcelParseOptions options, Boolean bReadOnly, String password)
в Syncfusion.XlsIO.Implementation.ApplicationImpl.CreateWorkbook(Object parent, String strTemplateFile, ExcelParseOptions options, Boolean bReadOnly, String password)
в Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(String fileName, ExcelParseOptions options, Boolean isReadOnly, String password)

Yavanaarasi G [Syncfusion]
Replied On August 14, 2008 05:38 AM UTC

Hi dvshestakov,

Thank you for your interest in Syncfusion products.

I am not able to reproduce the issue that you mentioned here. As per your requirements I have created a file, protect the workbook(Tools->Protection->ProtectWorkbook) and open the file in XlsIO using OpenReadOnly or open method. It works without any exception.

Here is the sample for your reference:


Please take a look into the above sample and if still the issue exists, could you please try reproducing it in the above sample and send us the modified sample with your file so that we could sort out the cause of the issue and provide you a solution?

Also please provide details about the system configuration and Essential studio version that you have used.


Administrator [Syncfusion]
Replied On September 2, 2008 05:08 AM UTC


Sorry for delay.

I used version, your example didn't work well. When I downloaded version, all is ok.


Geetha M [Syncfusion]
Replied On September 4, 2008 01:25 PM UTC


Thank you for the update.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon