java poi Excel单元格保护
来源:互联网 发布:ubuntu系统下安装win7 编辑:程序博客网 时间:2024/05/18 04:51
XSSFCellStyle style2 = workbook.createCellStyle();
//设置此style2为锁定
style2.setFillPattern(CellStyle.DIAMONDS);
style2.setFillBackgroundColor(HSSFColor.GREY_40_PERCENT.index);
style2.setLocked(true);
//sheet表加密:等效excel的审阅菜单下的保护工作表
//sheet.protectSheet(new String("333"));//333是密码
//workbook.writeProtectWorkbook("abc", "abc");
sheet.enableLocking();
CTSheetProtection sheetProtection = sheet.getCTWorksheet().getSheetProtection();
sheetProtection.setSelectLockedCells(false);
sheetProtection.setSelectUnlockedCells(false);
sheetProtection.setFormatCells(true);
sheetProtection.setFormatColumns(true);
sheetProtection.setFormatRows(true);
sheetProtection.setInsertColumns(true);
sheetProtection.setInsertRows(false);
sheetProtection.setInsertHyperlinks(true);
sheetProtection.setDeleteColumns(true);
sheetProtection.setDeleteRows(true);
sheetProtection.setSort(false);
sheetProtection.setAutoFilter(false);
sheetProtection.setPivotTables(true);
sheetProtection.setObjects(true);
sheetProtection.setScenarios(true);
//设置此style2为锁定
style2.setFillPattern(CellStyle.DIAMONDS);
style2.setFillBackgroundColor(HSSFColor.GREY_40_PERCENT.index);
style2.setLocked(true);
//sheet表加密:等效excel的审阅菜单下的保护工作表
//sheet.protectSheet(new String("333"));//333是密码
//workbook.writeProtectWorkbook("abc", "abc");
sheet.enableLocking();
CTSheetProtection sheetProtection = sheet.getCTWorksheet().getSheetProtection();
sheetProtection.setSelectLockedCells(false);
sheetProtection.setSelectUnlockedCells(false);
sheetProtection.setFormatCells(true);
sheetProtection.setFormatColumns(true);
sheetProtection.setFormatRows(true);
sheetProtection.setInsertColumns(true);
sheetProtection.setInsertRows(false);
sheetProtection.setInsertHyperlinks(true);
sheetProtection.setDeleteColumns(true);
sheetProtection.setDeleteRows(true);
sheetProtection.setSort(false);
sheetProtection.setAutoFilter(false);
sheetProtection.setPivotTables(true);
sheetProtection.setObjects(true);
sheetProtection.setScenarios(true);
阅读全文
0 0
- java poi Excel单元格保护
- Poi Excel单元格受保护
- POI 生成Excel表格 设置单元格保护
- java 使用poi导出Excel,设置单元格保护不可编辑,设置下拉框
- JAVA POI 操作EXCEL 合并单元格
- java设置Excel单元格格式 POI
- Java poi导出excel合并标题单元格
- java poi导出excel,合并单元格
- poi java导出excel时合并单元格
- java POI实现Excel单元格填充颜色
- java POI 实现Excel合并单元格
- java POI设置Excel单元格字体
- java POI实现Excel单元格自定义颜色
- java POI实现Excel单元格数据换行
- java POI实现Excel单元格数据格式化
- java poi导出Excel表,合并单元格
- Java poi导出excel合并标题单元格
- java 基于poi 写入excel 合并单元格
- Android常用开源项目(三十八)
- idea 使用拦截器mvc:exclude-mapping 报红
- 百万级流量网站准备工作
- 第十一章 表示与描述
- ngrok 内网穿透
- java poi Excel单元格保护
- 【一张大图看懂人工智能】百度总裁陆奇:人工智能是中国的历史性机遇
- ie浏览器设置默认文档模式
- SQL 筛选某一时间大于某一个值的数据及数量
- was节点不同步解决方法
- 如何绕过官方iCloud服务器,激活带有Apple ID锁的设备!
- C++传指针和引用demo
- ab 压力测试命令
- javaWeb编程_Servlet02