Closed Zncl2222 closed 2 months ago
Thanks for your issue. I have added get and set pivot table classical layout support by referenced your code. Please upgrade the master branch code by go get -u github.com/xuri/excelize/v2@master
, and this feature will be released in the next version.
Description
It seems that excelize does not support setting the classic layout for pivot tables currently.
Howevere I needed this function, so I made some adjustments to implement it.
You can find implementation here:
https://github.com/Zncl2222/excelize/commit/5f7a4ce4ada6c5150e56d4a9e4c9103f640d6e75
The classic layout need to set
Compact
andCompactData
tofalse
, setGridDropZones
totrue
inPivotTableDefinition
, and setOutline
andCompact
in each field tofalse
I am happy to submit a PR if you find this idea valuable. If you approve this proposal, I will modify the commit message to follow the style of excelize's commit messages and add more test cases if needed.
Example
In this implementation https://github.com/Zncl2222/excelize/commit/5f7a4ce4ada6c5150e56d4a9e4c9103f640d6e75, user only need to set the
ClassicLayout
to true inPivotTableOptions
to configure the pivot table in classic layout.The code snippet to create the pivot table with classic layout
If the
ClassicLayout
property is unset or set tofalse
, the pivot table will look like this: