I searched the forum and didn't come across an answer to what locking
actually does?

if i protect the sheet all cells are are uneditable no matter what i set the
lock style.
if i don't protect the sheet all cells are editable no matter what i set the
lock style.

i have certain columns that i would like to keep the users from editing and
some that they should be able to edit.

Below is a sample of code, like i mention above while setProtect(true) every
cell is locked, if i remove that every cell is unlocked. So what does
style.setLocked(boolean) do??

                HSSFWorkbook book = new HSSFWorkbook();
                HSSFSheet sheet = book.createSheet("agreements");
                sheet.setDefaultColumnWidth((short)18);

                sheet.setProtect(true);

                         HSSFCellStyle style = book.createCellStyle();  
                                      style.setLocked(true);
                
                HSSFCellStyle styleUnlock = book.createCellStyle();     
                        style.setLocked(false);

                HSSFRow row = sheet.createRow((short)0);
                HSSFCell cell = null;
                        cell = row.createCell((short)0);
                                cell.setCellValue("Product Code");
                                cell.setCellStyle(style);

                        cell = row.createCell((short)12);
                                cell.setCellValue("DPP Change Percent");
                                cell.setCellStyle(styleUnlock);

thanks in advance
Mike
-- 
View this message in context: 
http://www.nabble.com/locking-tp15613173p15613173.html
Sent from the POI - Dev mailing list archive at Nabble.com.


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

Reply via email to