How to refresh Pivot Cache of Excel 2010 using Open XML

夙愿已清 提交于 2019-12-11 05:38:35

问题


I am making an Excel Tool using Open XML for some data processing. In this I need to refresh my pivot tables programmatically after inserting the data by refreshing the pivot Cache. I can do this by Microsoft.Office.Interop.Excel assembly but it takes time in opening large files so I want to do this by using Open XML.

Do you have any idea that How can I do this using Open XML?

Please reply soon.

Thank you


回答1:


using SDK see the answers here: Excel "Refresh All" with OpenXML

when directly editing ooxml to fill a template xlsx:
edit pivotcache xml file: xl/pivotCache/pivotCacheDefinition*.xml
add the property-value: refreshOnLoad="1"
to node: pivotCacheDefinition

<pivotCacheDefinition 
    xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" 
    xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" 
    r:id="rId1" 
    refreshOnLoad="1">


来源:https://stackoverflow.com/questions/11670816/how-to-refresh-pivot-cache-of-excel-2010-using-open-xml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!