0

I want to reshape all selected items in PowerPoint by office-js.

But all the table's shape.type are "Unsupported" and the code below can not change the table width.

async function resizeSelectedShapes() {
  await PowerPoint.run(async (context) => {
    // First, get the current selection
    const selection = context.presentation.getSelectedShapes();
    selection.load("items");
    const shapeCounts = selection.getCount();
    await context.sync();

    selection.items.map((shape) => {
      shape.load("left,right,width,height");
    });
    await context.sync();
    const rsize = 0.8;
    selection.items.map((shape) => {
      shape.left *= 0.8;
      console.log(shape.type);
      shape.width *= 0.8;
      if (shape.type == "Image") {
        shape.height *= 0.8;
      }
    });
  });
}

I found I can use table in powerpoint web version, so access table in PowerPoint in office-js is possible or not?

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
PaleNeutron
  • 2,543
  • 4
  • 25
  • 43

1 Answers1

0

The supported list of shapes are defined in the PowerPoint.ShapeType enum. As you can see, there is no table in the list of supported shapes. So, you may post or vote for an existing feature request on Tech Community where they are considered when the Office dev team go through the planning process.

You may find the Work with shapes using the PowerPoint JavaScript API page helpful.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Thanks, I have read these page, none of these mentioned `table`, even not in a "not suported list". So I asked this question to make sure if I missed something. – PaleNeutron Dec 26 '22 at 01:00
  • You may post or vote for an existing feature request on [Tech Community](https://aka.ms/M365dev-suggestions) where they are considered when the Office dev team go through the planning process. – Eugene Astafiev Dec 26 '22 at 10:07