Excel公式不更新单元格 [英] Excel Formula Not Updating Cell

查看:57
本文介绍了Excel公式不更新单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 apache POI 更改 Excel 工作表中的单元格.更改值后,具有与已更改单元格对应的公式的单元格不会更新.

I am using apache POI to change cells in an excel sheet. After I change the values, the cells with formulas corresponding to cells that have been changed are not updating.

当我进入 excel 并单击带有公式的单元格,然后单击功能栏中的 时,公式会更新.

When I go into excel and click on the cell with the formula, and then click in the function bar, the formula updates.

我已将计算选项设置为自动更新.

I have calculation options set to automatically update.

快速示例.

行:

[A2 + A3] [1] [2]

[A2 + A3] [1] [2]

这里的A1等于3

当我使用 POI 更改它时:

When I change it using POI:

[A2+A3] [2] [5]

[A2+A3] [2] [5]

A1 仍然等于 3,直到我点击那个单元格.

A1 still equals 3 until I click on that cell.

刷新工作簿或工作表也不起作用.这是excel还是POI的问题?有人能想到解决方法吗?

Refreshing the workbook or sheet also does not work. Is this a problem with excel or POI? Can anyone think of a workaround?

推荐答案

如果您使用的是 XSSF 工作簿,您可以按如下方式重新评估所有公式单元格:

If you're using XSSF workbooks, you can re-evaluate all formula cells as follows:

XSSFFormulaEvaluator.evaluateAllFormulaCells(workbook)

如果您使用的是 HSSF 工作簿,则存在类似的 API:

A similar API exists if you're using an HSSF workbook:

HSSFFormulaEvaluator.evaluateAllFormulaCells(workbook)

或者,具体取决于您的设置方式以及您想要完成的具体工作,您应该能够找到您的解决方案 这里

Or, depending on exactly how you're set up and what specifically you're trying to get accomplished, you should be able to find your solution here

这篇关于Excel公式不更新单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆