Skip to content

The order of the pivot table supports custom fields #2051

@liuwangchao

Description

@liuwangchao

Description

Steps to reproduce the issue:

  1. I created a pivot table by this simple data and generated a simple pivot table
    1a84bed9702b470ba8d71e8a01c2b0bd
    9bf037fa975d44e7b06d071735bd5542

  2. But after I use Excel's Analyze - Fields, Items, and Sets - Calculated Fields function to add a field, and call func (f *File) getPivotTable(sheet, pivotTableXML, pivotCacheRels string)
    80f519cdf36e4d6fb364649c57aff7cc
    b98efa584c2f45158d057e7271076d4b
    73862595fc3b4e78ba30da577c8d6b3b

Describe the results you received:

I get panic: "msg":"runtime error: index out of range [3] with length 3"

Describe the results you expected:

The error was reported at line 955 of the func (f *File) extractPivotTableFields(order []string, pt *xlsxPivotTableDefinition, opts *PivotTableOptions), the pivot table has four fields, but the length of the ORDER is still 3.
c5515bf2ce3d474490f330777511d8e5

Output of go version:

1.22

Excelize version or commit ID:

v2.9.1-0.20241221071117-9934bf5c8634

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions