问题描述
如果单元格已具有值,则cell.setCellValue("HIDDEN")
是.xls文件中不覆盖的方法。
下面的代码仅在单元格为空时有效。
FileInputStream fsIP = new FileInputStream(new File(excelFilePath));
//Access the workbook
XSSFWorkbook workbook = new XSSFWorkbook(fsIP);
//Access the worksheet,so that we can update / modify it.
XSSFSheet worksheet = workbook.getSheetAt(0);
Cell cell = null;
// Access the second cell in second row to update the value
cell = worksheet.getRow(2).getCell(2);
// Get current cell value value and overwrite the value
cell = worksheet.getRow(2).getCell(3);
System.out.println("cellbefore"+cell);
cell.setCellValue("HIDDEN");
System.out.println("cellbAfter"+cell);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)