Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pivot table label/value filters #2009

Open
nathcoad opened this issue Oct 11, 2024 · 0 comments
Open

Add support for pivot table label/value filters #2009

nathcoad opened this issue Oct 11, 2024 · 0 comments

Comments

@nathcoad
Copy link

Description

Excelize can currently set a page filter for a pivot table, but does not seem to support creating label/value filters.

When running the sample code from https://xuri.me/excelize/en/pivot.html#AddPivotTable there is a page filter set for region, but clicking on the row filter in excel allows user to create label or value filters. For example,
image
image

Adding this value filter results in the following xml in pivotTables/pivotTable1.xml (including data above and below the filters node for context)

    <pivotTableStyleInfo name="PivotStyleLight16" showRowHeaders="1" showColHeaders="1"
        showRowStripes="0" showColStripes="0" showLastColumn="1" />
    <filters count="1">
        <filter fld="0" type="valueGreaterThan" evalOrder="-1" id="3" iMeasureFld="0">
            <autoFilter ref="A1">
                <filterColumn colId="0">
                    <customFilters>
                        <customFilter operator="greaterThan" val="5000" />
                    </customFilters>
                </filterColumn>
            </autoFilter>
        </filter>
    </filters>
    <extLst>
        <ext uri="{747A6164-185A-40DC-8AA5-F01512510D54}"
            xmlns:xpdl="http://schemas.microsoft.com/office/spreadsheetml/2016/pivotdefaultlayout">
            <xpdl:pivotTableDefinition16 />
        </ext>
    </extLst>
</pivotTableDefinition>

There are many filter operators such as equals, greater than, between, etc.

Output of go version:

go version go1.21.6 darwin/arm64

Excelize version or commit ID:

v2.8.1

Adding this feature would be greatly appreciated. Thankyou for all your amazing work on this module!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant