1

我正在制作一个使用Open XML进行一些数据处理的Excel 工具。在这种情况下,我需要在插入数据后通过刷新数据透视表以编程方式刷新数据透视表Cache。我可以通过Microsoft.Office.Interop.Excel 程序集来做到这一点,但打开大文件需要时间,所以我想通过使用 Open XML 来做到这一点。

您知道如何使用 Open XML 执行此操作吗?

请尽快回复。

谢谢

4

1 回答 1

1

使用 SDK 在这里查看答案: Excel "Refresh All" with OpenXML

直接编辑 ooxml 以填充模板时 xlsx:
编辑 pivotcache xml 文件:xl/pivotCache/pivotCacheDefinition*.xml
将属性值:refreshOnLoad="1"
添加到节点:pivotCacheDefinition

<pivotCacheDefinition 
    xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" 
    xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" 
    r:id="rId1" 
    refreshOnLoad="1">
于 2013-05-18T12:31:28.297 回答