I am trying to protect an excel sheet using Apache POI so that no Cell in the sheet can be written to but the cells in column C that must be editable. The problem is that my code is resulting in NONE of the excel being editable. This is the code I am using:
I debugged this and the issue seems to be that this line is returning null:
Cell c = r.getCell(editableColumn); The columm exist, but no cell in it has value. Actually, this is the reason why this column needs to be editable. This column will be filled later, and I have to make sure that only this column will be edited (and therefore I am trying to protect the rest of sheet). How could I set this empty column to NOT locked?
E torres wrote:I am trying to protect an excel sheet using Apache POI so that no Cell in the sheet can be written to but the cells in column C that must be editable.
I've moved your topic to a more suitable forum, as POI is quite specialized. You should get more answers there.
Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
Joined: Nov 07, 2013
Since I am already iterating I am considering this:
Still it feels like a ugly hack. For starters not being able to work directly with columns in an excel document feels weird (I am talking about the part in which I got to iterate over all the rows and set the protection options cell by cell), and now on the top of that if the document has a cell empty cannot work with it.
I am not complicating things too much? Does not exist a more intuitive/clear way of stating a column must be protected/unprotected?