Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2430
My worksheets are protected after save
posted
using Infragistics.Documents.Excel;
Using C:\Program Files (x86)\Infragistics\2015.1\Windows Forms\CLR4.0\Bin\Infragistics4.Win.UltraWinGrid.DocumentExport.v15.1.dll

I have a template file (.xlsx) - I open it everything is unprotected.  I update some of the data in formulas.
I go book.Save(); and when I re-open the worksheets are all protected.
I don't want any protection!

I checked book.Protected and book.Worksheets[0].Protected and everything is false!  
I then Close and re-open the book and it is shown as Protected = false again. 
I open in Excel 2013 and it shows as sheets are protected.  Why is that?

See attachment - open file in Excel 2013 and hit File and see that the sheets are protected. open up the same file via:
FileStream stream = File.OpenRead(sFileName);
Workbook book = Workbook.Load(stream);
stream.Close();

Check book.IsProtected and book.Worksheets[0].IsProtected

The sheets are proected in Excel 2013 but unprotected in Infragistics - what is up - how do I unprotect???
Original template prior to going through Infragistics is unprotected...
How do I make Excel realize that there is no protection?
tmp76CD_BANDMP_Shuttle Request Form.zip
Parents
No Data
Reply
  • 34510
    Offline posted

    Hi Haessd,

    When you open your template in order to edit the data, did you try calling Workbook.Unprotect() before saving it?  You shouldn't need to do this if the workbook was already unprotected before you opened it but it seems that editing your workbook is causing this to happen so it wouldn't hurt to call Unprotect().

    I tested this by creating my own xlsx file and then opening it with the Infragistics Excel framework.  I changed a value inside the workbook and then saved it back.  It did not open in Excel as a protected file so I'm not really sure why you see this occur.  Try calling Unprotect() and let me know how that turns out.

Children