刷新数据透视表与Apache POI [英] Refresh Pivot Table with Apache POI
问题描述
我目前正在对使用模板的Excel文件,包含数据透视表的Java应用程序。
I'm currently working on a Java application that uses a template excel file that contains a pivot table.
模板文件也有一个数据表的种子数据透视表。这个数据表是动态加载在通过Apache POI API的Java应用程序。
The template file also has a data sheet that seeds the pivot table. This data sheet is dynamically loaded in the java application through the Apache POI api.
当我打开Excel文件,我必须手动刷新得到正确加载的数据透视表。
When I open the excel file I must refresh the Pivot table manually to get the data loaded correctly.
有什么办法来刷新与POI API数据透视表,所以我没有做手工?
Is there any way to refresh the Pivot table with the POI api so I don't have to manually do it?
推荐答案
这是可能的。
在 PivotCacheDefinition
,还有一个属性 refreshOnLoad
可设置为真正
。打开工作簿时,缓存则又刷新。 <一href=\"http://msdn.microsoft.com/en-us/library/documentformat.openxml.s$p$padsheet.pivotcachedefinition.aspx\"相对=nofollow>更多信息这里。
It is possible.
In the PivotCacheDefinition
, there is an attribute refreshOnLoad
that can be set to true
. The cache is then refreshed when the workbook is opened. More information here.
在POI这可以通过调用方法 setRefreshOnLoad(布尔布尔)
,这需要一个布尔值作为参数,在CTPivotCacheDefinition完成。
In POI this can be done by calling the method setRefreshOnLoad(boolean bool)
, that takes a boolean as parameter, on a CTPivotCacheDefinition.
编辑:
在Apache POI现在提供了创建数据透视表的可能性,数据透视表进行刷新负荷为默认值。 类XSSFPivotTable
这篇关于刷新数据透视表与Apache POI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!