about SheetProtection

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
vga
Posts: 14
Joined: Tue Jul 29, 2008 9:19 pm

about SheetProtection

Post 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
torerik
Posts: 5
Joined: Fri Nov 12, 2004 2:08 am
Location: Norway

Re: about SheetProtection

Post 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.
vga
Posts: 14
Joined: Tue Jul 29, 2008 9:19 pm

Re: about SheetProtection

Post by vga »

when add:
xls1.Sheets[0].SheetProtection := DefaultSheetProtections;
it work fine now.
Post Reply