简体   繁体   English

使用Open XML和C#在Excel中创建数据透视表

[英]Creating Pivot Table in Excel using Open XML and C#

I used store a data into the DataTable and wants to create a Pivot Table using this data. 我曾经将数据存储到DataTable中,并想使用此数据创建数据透视表。

I have gone through many posts and also read the Microsoft's documentation on creating Pivot table through Open XML but couldn't get the solution. 我浏览了许多文章,还阅读了有关通过Open XML创建数据透视表的Microsoft文档,但无法获取解决方案。 Can anyone please post some code to create Pivot table. 任何人都可以发布一些代码来创建数据透视表。

Thanks in advance. 提前致谢。

Install the Open XML SDK , it contains a tool called Open XML SDK Productivity Tool. 安装Open XML SDK ,它包含一个名为Open XML SDK Productivity Tool的工具。

How to use it: 如何使用它:

Open Excel and create a file containing a Pivot table. 打开Excel并创建一个包含数据透视表的文件。 Save it and open it with the Productivity Tool. 保存并使用“生产力工具”将其打开。 In this tool is an option to 'Reflect the code', that way you can see how to create the same Excel by using C# code. 该工具中有一个“反映代码”的选项,这样您可以看到如何使用C#代码创建相同的Excel。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM