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

查看:647
本文介绍了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)

或者,取决于你到底如何设置和你想把你完成的具体是什么,你应该能够找到解决方案的这里

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

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