java给excel单元格上锁解锁

qq_38984067 2019-06-14 10:45:56
给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

这是怎么回事
...全文
156 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_38984067 2019-06-17
  • 打赏
  • 举报
回复
qq_38984067 2019-06-14
  • 打赏
  • 举报
回复

50,545

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧