You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Sascha Schaefer <Sa...@ebcsoft.de> on 2008/06/16 16:13:49 UTC
Protect or disable a cell
Hi,
I want to create an excel workbook and I want to prevent that a user changes the content of some special cells. I read the POI's API but I haven't found a solution for my problem. Is there any possibility to disable or protect some cells of an excel sheet?
Mit freundlichem Gruß
EBCsoft GmbH
Sascha Schäfer
Delitzscher Straße 69
04129 Leipzig
Tel: +49 341 2466261
Fax: +49 341 2466262
Re: AW: Protect or disable a cell
Posted by Spike <so...@gmail.com>.
Sorry for the 2 years delay on the answer, but I've noticed that when you
call the protectSheet() method, all cells in the sheet will be locked,
unless you tell them not to by setting a specific style.
But beware of sharing styles!!
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Protect-or-disable-a-cell-tp2299482p3250956.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
Re: Protect or disable a cell
Posted by Anthony Andrews <py...@yahoo.com>.
Sorry, I forgot the second bit;
Once you have cretaed HSSFCellStyle objects that allow you to lock the contents of certain cells and applied them to those cells, you need to call the setProtect(boolean) method of the sheet the cells are on.
--- On Mon, 6/16/08, Anthony Andrews <pythonaddict@yahoo.com> wrote:
From: Anthony Andrews <pythonaddict@yahoo.com>
Subject: Re: Protect or disable a cell
To: "POI Users List" <user@poi.apache.org>
Date: Monday, June 16, 2008, 11:02 PM
Not sure if this is what you want but take a look at the HSSFCellStyle class.
That class includes the setLocked(boolean) method and this may do what you
want. At the very least, it is worth a quick test.
Other than that, you could use an on activation macro if you know in advance
which cells require protection.
--- On Mon, 6/16/08, Sascha Schaefer &lt;Sascha.Schaefer@ebcsoft.de&gt;
wrote:
From: Sascha Schaefer &lt;Sascha.Schaefer@ebcsoft.de&gt;
Subject: Protect or disable a cell
To: "POI Users List" &lt;user@poi.apache.org&gt;
Date: Monday, June 16, 2008, 7:13 AM
Hi,
I want to create an excel workbook and I want to prevent that a user changes
the content of some special cells. I read the POI's API but I haven't
found a solution for my problem. Is there any possibility to disable or protect
some cells of an excel sheet?
Mit freundlichem Gruß
EBCsoft GmbH
Sascha Schäfer
Delitzscher Straße 69
04129 Leipzig
Tel: +49 341 2466261
Fax: +49 341 2466262
Re: Protect or disable a cell
Posted by Anthony Andrews <py...@yahoo.com>.
Not sure if this is what you want but take a look at the HSSFCellStyle class. That class includes the setLocked(boolean) method and this may do what you want. At the very least, it is worth a quick test.
Other than that, you could use an on activation macro if you know in advance which cells require protection.
--- On Mon, 6/16/08, Sascha Schaefer <Sascha.Schaefer@ebcsoft.de> wrote:
From: Sascha Schaefer <Sascha.Schaefer@ebcsoft.de>
Subject: Protect or disable a cell
To: "POI Users List" <user@poi.apache.org>
Date: Monday, June 16, 2008, 7:13 AM
Hi,
I want to create an excel workbook and I want to prevent that a user changes
the content of some special cells. I read the POI's API but I haven't
found a solution for my problem. Is there any possibility to disable or protect
some cells of an excel sheet?
Mit freundlichem Gruß
EBCsoft GmbH
Sascha Schäfer
Delitzscher Straße 69
04129 Leipzig
Tel: +49 341 2466261
Fax: +49 341 2466262