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

The order of the pivot table supports custom fields #2051

Closed
liuwangchao opened this issue Dec 23, 2024 · 1 comment
Closed

The order of the pivot table supports custom fields #2051

liuwangchao opened this issue Dec 23, 2024 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@liuwangchao
Copy link
Contributor

liuwangchao commented Dec 23, 2024

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
@xuri xuri added bug Something isn't working in progress Working in progress labels Jan 4, 2025
@xuri xuri moved this to Bugfix in Excelize v2.9.1 Jan 4, 2025
@xuri xuri added the duplicate This issue or pull request already exists label Jan 4, 2025
@xuri xuri closed this as completed in af422e1 Jan 5, 2025
@xuri
Copy link
Member

xuri commented Jan 5, 2025

Thanks for your feedback. This issue duplicated with #1954, I fixed this, please upgrade to the master branch code by following command, this patch will be released on the next version.

go get -u github.com/xuri/excelize/v2@master

@xuri xuri removed in progress Working in progress bug Something isn't working labels Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
Status: Bugfix
Development

No branches or pull requests

2 participants