setLocked(false)应该可编辑的单元格。
String file = "c:\poitest.xlsx";FileOutputStream outputStream = new FileOutputStream(file);Workbook wb = new XSSFWorkbook();CellStyle unlockedCellStyle = wb.createCellStyle();unlockedCellStyle.setLocked(false);Sheet sheet = wb.createSheet();sheet.protectSheet("password");Row row = sheet.createRow(0);Cell cell = row.createCell(0);cell.setCellValue("TEST");cell.setCellStyle(unlockedCellStyle);wb.write(outputStream);outputStream.close();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)