ApachePOI无法更新公式
创始人
2024-09-06 09:01:00
0

如果您使用的版本不是POI 3.5或更高版本,则可能会遇到此问题。 在这种情况下,您需要使用POI 3.5或更高版本才能更新公式。

另外,请确保已使用 FormulaEvaluator 对象对更新的公式进行了重新计算。 以下是一个示例:

// Obtain the workbook object Workbook workbook = WorkbookFactory.create(new FileInputStream("workbook.xls"));

// Get the sheet you want to update the formula in Sheet sheet = workbook.getSheetAt(0);

// Get the cell that contains the formula you want to update Cell cellToUpdate = sheet.getRow(0).getCell(0);

// Update the formula with the new formula cellToUpdate.setCellFormula("SUM(A1:A10)");

// Obtain a FormulaEvaluator object FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();

// Evaluate the cell to update the formula evaluator.evaluateFormulaCell(cellToUpdate);

// Save the changes to the workbook FileOutputStream fileOut = new FileOutputStream("workbook.xls"); workbook.write(fileOut); fileOut.close();

相关内容

热门资讯

透视脚本!wpk辅助哪里买,w... 透视脚本!wpk辅助哪里买,wpk真吗,线上教程(有挂技巧)wpk辅助哪里买是一种具有地方特色的麻将...
透视科技!hhpoker免费透... 透视科技!hhpoker免费透视脚本,hhpoker有透视功能吗,2025版教程(有挂揭秘)1、游戏...
透视实锤!wpk可以作弊吗,w... 透视实锤!wpk可以作弊吗,wpk私人局有透视吗,大神讲解(有挂方法);1、透视实锤!wpk可以作弊...
透视计算!hhpoker有透视... 透视计算!hhpoker有透视功能吗,hhpoker德州有挂吗,2025新版技巧(有挂详情)1、完成...
透视游戏!wpk透视工作室,w... 透视游戏!wpk透视工作室,wpk刷入池率脚本,必赢方法(有挂揭秘)1)wpk刷入池率脚本辅助挂:进...
透视透视!hhpoker是正品... 透视透视!hhpoker是正品吗,hhpoker俱乐部是干嘛的,解说技巧(有挂规律)1、hhpoke...
透视新版!wpk系统是否存在作... 透视新版!wpk系统是否存在作弊行为,wpk模拟器是什么,细节方法(有挂介绍)1、wpk系统是否存在...
透视透视挂!hhpoker辅助... 透视透视挂!hhpoker辅助软件,hhpoker有辅助吗,必赢方法(有挂解说);1、用户打开应用后...
透视脚本!有哪些免费的wpk作... 透视脚本!有哪些免费的wpk作弊码,wpk透视工作室,详细教程(有挂揭秘)1、这是跨平台的有哪些免费...
透视软件!hhpoker辅助,... 透视软件!hhpoker辅助,hhpkoer辅助挂是真的吗,安装教程(有挂插件)1、实时hhpkoe...