如何在Excel C#中添加报表过滤器

时间:2016-11-03 13:48:43

标签: c# asp.net asp.net-mvc-4 c#-4.0

我想使用报告过滤器在excel中导出数据透视表,我目前正在使用EPPLUS但是epplus无法实现。请有人告诉我应该使用哪个库来导出带有报告过滤器的数据库。

1 个答案:

答案 0 :(得分:1)

You can try to use Microsoft.Office.Interop.Excel for pivot tables in Excel using C#.

A code example of using pivot table of the Office.Interop is:

PivotTable pt = (PivotTable)activeWorksheet.PivotTables("PivotTable1");
PivotField pf = (PivotField)pt.PivotFields(11);
pf.ClearAllFilters();

This article also gives more information about creating pivot tables.

https://blogs.msdn.microsoft.com/andreww/2008/07/25/creating-a-pivottable-programmatically/