Page 1 of 1

about SheetProtection

Posted: Thu Jul 28, 2011 3:16 am
by vga
I want to remove Protection of a xls file,

My Code:


xls1.Filename := 'c:\aa.xls';
xls1.Read;
xls1.Sheets[0].SheetProtection := [];
xls1.Write;

it seems not work.

why?

delphi xe & xlsreadwrite II 4.0053

Re: about SheetProtection

Posted: Sun Jul 31, 2011 8:54 am
by torerik
[quote="vga"]I want to remove Protection of a xls file,
[/quote]

It seems that the current version erroneously inserts sheet protection into the xls file regardless of your code.
I have already reported this as a bug.
It has existed afaik at least since 4.00.49, but may be related to reading an already malformed xls, because creating a new xls file programatically works ok.

T.

Re: about SheetProtection

Posted: Thu Aug 11, 2011 12:49 am
by vga
when add:
xls1.Sheets[0].SheetProtection := DefaultSheetProtections;
it work fine now.