eozturk's avatar
eozturk
Brass Contributor
Oct 26, 2023
Status:
New

Support for getting Powerpoint slide dimensions dynamically

Similar to this post, having a support to get Powerpoint slide dimensions dynamically would be very beneficial for us to calculate position and dimension of an image or shape that is going to be imported.

 

Use case: 

We are currently developing a Powerpoint taskpane add-in, that imports images selected by user. Currently, we use 960x540 px dimensions as default slide width and height as it seems to be dimensions of a default slide for 16:9 aspect ratio, in order to fit the imported image within slide and calculate its position to center it. However, if user changes the slide dimensions manually, this calculation will mean nothing.

 

In order to support this, we need Powerpoint JS Api to return current slide's width and height dimensions. Something like below;

 

(await window.PowerPoint.run(async (powerPointContext) => powerPointContext)).presentation.width;

(await window.PowerPoint.run(async (powerPointContext) => powerPointContext)).presentation.height;

or,

(await window.PowerPoint.run(async (powerPointContext) => powerPointContext)).presentation.slides[0].width;

(await window.PowerPoint.run(async (powerPointContext) => powerPointContext)).presentation.slides[0].height;

 

 

1 Comment

  • macg's avatar
    macg
    Copper Contributor

    There are at least three separate requests for this.  I hope they are considered in aggregate by MSFT.  We're probably more likely to get what we need if we upvote existing requests and add commentary to those as desired, rather than create new, duplicate requests.