question

Paul-6293 avatar image
2 Votes"
Paul-6293 asked AaronC-2091 answered

Collapse pivot table fields via excel JS api

I have an addin using the excel JS api that generates a pivot table. I wish to collapse the fields of this pivot table. This seems to be possible in the VBA api via pf.ShowDetail and DrillTo, but these functions/fields do not seem to be present in the JS api. Is there any workaround or similar method I can use?

If not, is there a place where I can request that this feature be added to the JS API?

office-addins-devoffice-js-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AaronC-2091 avatar image
2 Votes"
AaronC-2091 answered

We found that you can collapse individual items in the pivot table by digging all the way down to the PivotItem and setting the isExpanded field (see docs here).

This is a pain though because we really want to just have every item collapsed for every row field (everything is expanded by default), so to accomplish this we have to manually dig through every field and every item to collapse them. We'd really like to have something equivalent to the "collapse entire field" functionality you get in the UI.

Is there a place where we can request this feature?


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.