Just trying out 3.0.2 I noticed that the new protectSheet method for HSSFSheet
doesn't seem to work on all sheets, my code to attempt to lock all sheets with
the password 'joshua' is as follows: 


                int numSheets = wb.getNumberOfSheets();
                for( int i = 0; i < numSheets; i++) {
                        HSSFSheet sheet = wb.getSheetAt(i);
                        sheet.protectSheet("joshua");
                }

This only seems to lock the first and last sheets in my work book.

Im working in workbook with 5 sheets where the first 4 are basically a template

that I dont touch in the Java, I just open the 5th sheet and dump a load of raw

numbers and text in to be interpreted and referenced by the first 4 sheets.

So I am able to successfully lock sheets 0 and 4 with the desired password, but

the other sheets all just appear as normal in excel as if no attempt to lock

them was ever attempted.

I've tried checking that all the sheets are being locked using the following 
code:

                for( int i = 0; i < numSheets; i++) {
                        HSSFSheet sheet = wb.getSheetAt(i);

                        logger.info(i + " " + sheet.getProtect());
                        sheet.protectSheet("joshua");
                        logger.info(i + " " + sheet.getProtect());
                }

Sure enough that tells me that the protect property changes from false to true

for all my sheets after the protectSheet method is run, but still in excel the

sheets appear as unlocked.

The only distinguishing factor about those the 3 middle sheets is that they all
contain charts.


Just in case it could be relevant: My platform is jboss-4.2.1.GA


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to