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

Bugs on pivot table #884

Open
JerryXBear opened this issue Apr 28, 2021 · 0 comments
Open

Bugs on pivot table #884

JerryXBear opened this issue Apr 28, 2021 · 0 comments
Labels
office-js Issue with office-js platform - NOT Script Lab

Comments

@JerryXBear
Copy link

Bug Report
Excel Script lab.

Expected behavior:
Print the information of each item in dataHierarchies.Class.
Actual behavior:

Excel shuts down or restarts if adding more then 3 items into dataHierachies.(bug)
It's ok if adding less than or eqaul to 3 items.(no bug)

Steps to Reproduce:
grab worksheet.
add pivot table
add row into pivot table
add dataHierachies into pivot table.
run the program

Failure Logs:
Excel restarts or shuts down.

Screenshot:

image

It is my sample code. You can try this.

async function run() {
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Table");
const table = sheet.tables.getItem("Table");
const pivots = sheet.pivotTables;
const pivot = pivots.add("Temp", table, "Table!J1");

pivot.rowHierarchies.add(pivot.hierarchies.getItem("Name"));
pivot.rowHierarchies.add(pivot.hierarchies.getItem("Position"));

pivot.dataHierarchies.add(pivot.hierarchies.getItem("Age"));

pivot.dataHierarchies.add(pivot.hierarchies.getItem("Time"));

pivot.dataHierarchies.add(pivot.hierarchies.getItem("Salary"));

pivot.dataHierarchies.add(pivot.hierarchies.getItem("Gain"));

pivot.dataHierarchies.add(pivot.hierarchies.getItem("Tax"));

pivot.dataHierarchies.add(pivot.hierarchies.getItem("length of career"));

pivot.dataHierarchies.load("items");

await context.sync().then(async function () {
console.log(pivot.dataHierarchies.items[0])
})
});
}

@wandyezj wandyezj added the office-js Issue with office-js platform - NOT Script Lab label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
office-js Issue with office-js platform - NOT Script Lab
Projects
None yet
Development

No branches or pull requests

2 participants