Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Mon Jun 02, 2014 6:47 pm

Please let me kwow how to add report filter.
How to use "pivotTable.ReportFilters"?

Thanks

jouji_s
 
Posts: 6
Joined: Fri Mar 07, 2014 6:22 pm

Tue Jun 03, 2014 8:28 am

Hello,

Thanks for your inquiry.
Sorry that at present our Product doesn't support the feature. And We have added it to our schedule. Once it is added, we will let you know ASAP.
If there are any questions, welcome to get it back to us.
Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Jun 03, 2014 2:52 pm

Hello,

I found following post.
e-iceblue.com/forum/how-do-i-add-report-filter-in-pivot-t2432.html

I think you have already added this function.
Please let me know hot to use.

Thanks.

jouji_s
 
Posts: 6
Joined: Fri Mar 07, 2014 6:22 pm

Wed Jun 04, 2014 2:10 am

Hello,

Thanks for your response, although the function has been added, after testing again there are some problems exist in the function such as the add method, so at present it still doesn't work. Our Dev team will fix it further. Sorry for inconvenience.
If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Mon Jun 09, 2014 8:59 am

Hello,

The issue has been resolved, and the newest hotfix has been released, you can download the Spire.XLS Pack Hotfix Version:7.4.13 and refer the following method.
Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile("sample.xlsx");
Spire.Xls.Core.Spreadsheet.PivotTables.XlsPivotTable pivotTable = workbook.Worksheets["Pivot Table"].PivotTables[0] as Spire.Xls.Core.Spreadsheet.PivotTables.XlsPivotTable;
PivotReportFilter filter = new PivotReportFilter("Name", true);
pivotTable.ReportFilters.Add(filter);
workbook.SaveToFile("result.xlsx", ExcelVersion.Version2007);

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Mar 25, 2020 3:10 pm

Hello.

How can i select a default value in report filter? This is my code:

PivotReportFilter filter = new PivotReportFilter("GRUPO", true);
pt.ReportFilters.Add(filter);
sheet2.Range["B1"].Text = "[VALUE_I_WANT]";

Thanks,

David

dmaciasaviles
 
Posts: 6
Joined: Wed Oct 09, 2019 11:56 am

Thu Mar 26, 2020 6:12 am

Hi David,

Thanks for your inquiry.
Please refer to the following code to select the default value in report filter, and attached are my input file and output file. If there is any question, please provide your input file as well as your desired output for further investigation.
Code: Select all
        Workbook workbook = new Workbook();
        workbook.LoadFromFile("CreatePivotTable.xlsx");
        Worksheet sheet = workbook.Worksheets[0];
        Worksheet sheet2 = workbook.CreateEmptySheet();
        sheet2.Name = "Pivot";

        CellRange dataRange = sheet.Range["A1:C17"];
        PivotCache cache = workbook.PivotCaches.Add(dataRange);
        PivotTable pt = sheet2.PivotTables.Add("Pivot Table", sheet.Range["A1"], cache);
        pt.EnableDrilldown = true;

        var r1 = pt.PivotFields["Product"];
        r1.Axis = AxisTypes.Row;

        var r2 = pt.PivotFields["Month"];
        r2.Axis = AxisTypes.Row;

        pt.DataFields.Add(pt.PivotFields["Count"], "Sum of Count", SubtotalTypes.Sum);

        //**********************************************
        //select the default value in report filter
        PivotReportFilter filter = new PivotReportFilter("Product", true);
        filter.IsMultipleSelect = true;
        List<string> list = new List<string>();
        list.Add("SpireDoc");
        filter.FilterItemStrings = list;
        pt.ReportFilters.Add(filter);
        //**********************************************

        pt.CalculateData();
        pt.Cache.IsRefreshOnLoad = true;
        workbook.SaveToFile("result.xlsx",FileFormat.Version2013);


Sincerely,
Rachel
E-iceblue support team
You do not have the required permissions to view the files attached to this post.
User avatar

rachel.lei
 
Posts: 645
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Doc