You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by tcole6 <tc...@gmail.com> on 2012/03/23 14:38:57 UTC

lockSelectLockedCells() and protectSheet(String)

I am dynamically creating an XLSX from database data, which is to result in a
type of Excel form. There are certain cells that should be user editable,
and cells that are not.

I sem to have gotten ALMOST everything I need and the sheet works well with
one exception...I call XSSFSheet.lockSelectLockedCells() so the user can't
select locked cells (works) but...if I attempt to lock down the sheet with a
password by using protectSheet(String), I get an invalid document that can't
be opened by Excel. If I use XSSFSheet.enableLocking() instead to turn on
locking, everything is locked properly and the sheet CAN be opened, but...
the user can unlock the sheet without needing a password (not good).

Note that if I do NOT call lockSelectLockedCells(), then I CAN successfully
lock the sheet down with a password using protectSheet(String). The problem
then is that the user can select locked cells (they can't edit, but they can
select, which results in this annoying popup window each time they
accidently select a locked cell and attempt to type), which is not
preferable.

I just can't appear to do both. Is there another mechanism by which I can
set the lock password before or after calling enableLocking()?

Many thanks. I love POI and you guys and gals are doing one EXCELlent job
(sorry, had to be done :)).


--
View this message in context: http://apache-poi.1045710.n5.nabble.com/lockSelectLockedCells-and-protectSheet-String-tp5589484p5589484.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org