Hello,
how does I use the setLocked() method correctly?
What does I have to do with the excelfile?
Are there any options I have to prepare the excelfile with, before I
read the file?
here is a small codesnip:
POIFSFileSystem fs = new POIFSFileSystem(new
FileInputStream(tempFilePath));
HSSFWorkbook wb2 = new HSSFWorkbook(fs);
HSSFSheet sheet2 = wb2.getSheetAt(0);
//sheet2.setProtect(true); // <--- throws a Nullpointer if
uncommented, why?
//System.out.println("PROTECTED: " + sheet2.getProtect());
HSSFRow row2 = sheet2.getRow(0);
HSSFCell cell2 = null;
HSSFCellStyle cs = wb2.createCellStyle();
cs.setLocked(true); // <-- this should set the file locked, isn't
it?
cell2 = row2.getCell((short) cols);
if (cell2 == null)
{
cell2 = row2.createCell((short) cols);
cell2.setCellStyle(cs);
cell2.setCellValue("not entered");
}//if
FileOutputStream fileOut = new
FileOutputStream(tempFilePath+"workbook2.xls");
wb2.write(fileOut);
fileOut.close();
I hope you are able to help me.
regards,
marek