PowerPoint JavaScript preview APIs
New PowerPoint JavaScript APIs are first introduced in "preview" and later become part of a specific, numbered requirement set after sufficient testing occurs and user feedback is acquired.
Note
Preview APIs are subject to change and are not intended for use in a production environment. We recommend that you try them out in test and development environments only. Do not use preview APIs in a production environment or within business-critical documents.
To use preview APIs:
- You must use the preview version of the Office JavaScript API library from the Office.js content delivery network (CDN). The type definition file for TypeScript compilation and IntelliSense is found at the CDN and DefinitelyTyped. You can install these types with
npm install --save-dev @types/office-js-preview
(be sure to remove the types for@types/office-js
if you've previously installed them). - You may need to join the Microsoft 365 Insider program for access to more recent Office builds.
API list
The following table lists the PowerPoint JavaScript APIs currently in preview. For a complete list of all PowerPoint JavaScript APIs (including preview APIs and previously released APIs), see all PowerPoint JavaScript APIs.
Class | Fields | Description |
---|---|---|
Shape | group | Returns the ShapeGroup associated with the shape. |
level | Returns the level of the specified shape. | |
parentGroup | Returns the parent group of this shape. | |
ShapeCollection | addGroup(values: Array<string | Shape>) | Create a shape group for several shapes. |
ShapeGroup | id | Gets the unique ID of the shape group. |
shape | Returns the Shape object associated with the group. |
|
shapes | Returns the collection of Shape objects in the group. |
|
ungroup() | Ungroups any grouped shapes in the specified shape group. | |
ShapeScopedCollection | group() | Groups all shapes in this collection into a single shape. |
Slide | applyLayout(slideLayout: PowerPoint.SlideLayout) | Applies the specified layout to the slide, changing its design and structure according to the chosen layout. |
exportAsBase64() | Exports the slide to its own presentation file, returned as Base64-encoded data. | |
getImageAsBase64(options?: PowerPoint.SlideGetImageOptions) | Renders an image of the slide. | |
index | Returns the zero-based index of the slide representing its position in the presentation. | |
moveTo(slideIndex: number) | Moves the slide to a new position within the presentation. | |
SlideGetImageOptions | height | The desired height of the resulting image in pixels. |
width | The desired width of the resulting image in pixels. | |
SlideLayout | type | Returns the type of the slide layout. |
See also
Office Add-ins