使用Apache POI HSSF,我怎么能刷新所有公式的单元格一次? [英] Using Apache POI HSSF, how can I refresh all formula cells at once?

查看:1054
本文介绍了使用Apache POI HSSF,我怎么能刷新所有公式的单元格一次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我灌装使用Apache POI Excel文件的单元格,并有在文档中有很多公式的单元格。然而,当我在Excel中打开该文档的值不会刷新。

I am filling cells of an Excel file using Apache POI, and there are a lot of formula cells in the document. However, their values are not refreshed when I open the document in Excel.

这是我的理解,我需要使用 FormulaEvaluator 刷新公式的单元格。有没有一种方法,不过,一次更新所有公式的单元格?有一个的很多的他们,同时使一个详尽的清单是不是没问题,它肯定不是我很愿意做。

It's my understanding that I need to use a FormulaEvaluator to refresh formula cells. Is there a way, though, to update all formula cells at once? There are a lot of them, and while making an exhaustive list is not out of question, it's certainly not something I'm very willing to do.

推荐答案

当然。在工作​​簿中刷新所有的公式可能是更典型的用例反正。

Sure. Refreshing all the formulas in a workbook is possibly the more typical use case anyway.

如果你使用HSSF,叫<一个href=\"http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.html#evaluateAllFormulaCells%28org.apache.poi.hssf.usermodel.HSSFWorkbook%29\">evaluatorAllFormulaCells:

If you're using HSSF, call evaluatorAllFormulaCells:

 HSSFFormulaEvaluator.evaluateAllFormulaCells(hssfWorkbook)

如果你使用XSSF,叫<一个href=\"http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFFormulaEvaluator.html#evaluateAllFormulaCells%28org.apache.poi.xssf.usermodel.XSSFWorkbook%29\">evaluatorAllFormulaCells:

If you're using XSSF, call evaluatorAllFormulaCells:

 XSSFFormulaEvaluator.evaluateAllFormulaCells(xssfWorkbook)

更多详细信息可在poi网站

这篇关于使用Apache POI HSSF,我怎么能刷新所有公式的单元格一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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