1
votes

In Excel, a table can be resized by dragging its lower-right corner, which makes a table bigger (or smaller) without inserting (or removing) any cells in the worksheet (see “Sizing handle” in Microsoft’s “Overview of Excel tables”). The equivalent action can be done through the VBA API using “ListObject.resize”: “The Resize method allows a ListObject object to be resized over a new range. No cells are inserted or moved.”

How can this be done through the JavaScript API? I’m probably overlooking the obvious, but the class “Table” at least doesn’t seem to offer a method “resize”.

2
As requested in the answer by Raymond Lu, I've added this as a feature request on UserVoice: officespdev.uservoice.com/forums/…Rinzwind

2 Answers

0
votes

Good news, we have created this API and We release table.resize() last month together with SAC, now you could try it out. here is the code sample。

await Excel.run(async (context) => {
  // Retrieve the worksheet and a table on that worksheet.
  const sheet = context.workbook.worksheets.getItem("Sample");
  const expensesTable = sheet.tables.getItem("ExpensesTable");
  
  // Resize the table.
  expensesTable.resize("A1:D20");
  
  await context.sync();
});
0
votes

Yes, table resize API is currently not available in office JS. but this is in our backlog. Could you please create your request in [uservoice][1] and upvote your request?