java给excel单元格上锁解锁
给excel单元格上锁解锁
XSSFCellStyle style = sheetpw.getRow(6).getCell(2).getCellStyle();
DebuggingLog.printInformation("style.getLocked():"+style.getLocked());
style.setLocked(false);
DebuggingLog.printInformation("style.getLocked():"+style.getLocked());
sheetpw.getRow(6).getCell(2).setCellStyle(style);
XSSFCellStyle style1 = sheetpw.getRow(5).getCell(2).getCellStyle();
DebuggingLog.printInformation("style1.getLocked():"+style1.getLocked());
style1.setLocked(true);
DebuggingLog.printInformation("style1.getLocked():"+style1.getLocked());
DebuggingLog.printInformation("style.getLocked():"+style.getLocked());
sheetpw.getRow(5).getCell(2).setCellStyle(style1);
XSSFCellStyle style3 = sheetpw.getRow(6).getCell(2).getCellStyle();
XSSFCellStyle style4 = sheetpw.getRow(5).getCell(2).getCellStyle();
DebuggingLog.printInformation("style3.getLocked():"+style3.getLocked());
DebuggingLog.printInformation("style4.getLocked():"+style4.getLocked());
打印出来是这样的
style.getLocked():true
tyle.getLocked():false
style1.getLocked():false
style1.getLocked():true
style.getLocked():true
style3.getLocked():true
tyle4.getLocked():true
这是怎么回事