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 |
---|---|---|
CustomProperty | delete() | Deletes the custom property. |
key | The string that uniquely identifies the custom property. | |
type | The type of the value used for the custom property. | |
value | The value of the custom property. | |
CustomPropertyCollection | add(key: string, value: boolean | Date | number | string) | Creates a new CustomProperty or updates the property with the given key. |
deleteAll() | Deletes all custom properties in this collection. | |
getCount() | Gets the number of custom properties in the collection. | |
getItem(key: string) | Gets a CustomProperty by its key. |
|
getItemOrNullObject(key: string) | Gets a CustomProperty by its key. |
|
items | Gets the loaded child items in this collection. | |
CustomXmlPart | delete() | Deletes the custom XML part. |
getXml() | Gets the XML content of the custom XML part. | |
id | The ID of the custom XML part. | |
namespaceUri | The namespace URI of the custom XML part. | |
setXml(xml: string) | Sets the XML content for the custom XML part. | |
CustomXmlPartCollection | add(xml: string) | Adds a new CustomXmlPart to the collection. |
getByNamespace(namespaceUri: string) | Gets a new scoped collection of custom XML parts whose namespaces match the given namespace. | |
getCount() | Gets the number of custom XML parts in the collection. | |
getItem(id: string) | Gets a CustomXmlPart based on its ID. |
|
getItemOrNullObject(id: string) | Gets a CustomXmlPart based on its ID. |
|
items | Gets the loaded child items in this collection. | |
CustomXmlPartScopedCollection | getCount() | Gets the number of custom XML parts in this collection. |
getItem(id: string) | Gets a CustomXmlPart based on its ID. |
|
getItemOrNullObject(id: string) | Gets a CustomXmlPart based on its ID. |
|
getOnlyItem() | If the collection contains exactly one item, this method returns it. | |
getOnlyItemOrNullObject() | If the collection contains exactly one item, this method returns it. | |
items | Gets the loaded child items in this collection. | |
DocumentProperties | author | The author of the presentation. |
category | The category of the presentation. | |
comments | The Comments field in the metadata of the presentation. | |
company | The company of the presentation. | |
creationDate | The creation date of the presentation. | |
customProperties | The collection of custom properties of the presentation. | |
keywords | The keywords of the presentation. | |
lastAuthor | The last author of the presentation. | |
manager | The manager of the presentation. | |
revisionNumber | The revision number of the presentation. | |
subject | The subject of the presentation. | |
title | The title of the presentation. | |
Presentation | customXmlParts | Returns a collection of custom XML parts that are associated with the presentation. |
properties | Gets the properties of the presentation. | |
Shape | customXmlParts | Returns a collection of custom XML parts in the shape. |
type | Returns the type of this shape. | |
Slide | customXmlParts | Returns a collection of custom XML parts in the slide. |
exportAsBase64() | Exports the slide to its own presentation file, returned as Base64-encoded data. | |
getImageAsBase64(options?: PowerPoint.SlideGetImageOptions) | Renders an image of the slide. | |
SlideGetImageOptions | height | The desired height of the resulting image in pixels. |
width | The desired width of the resulting image in pixels. | |
SlideLayout | customXmlParts | Returns a collection of custom XML parts in the slide layout. |
SlideMaster | customXmlParts | Returns a collection of custom XML parts in the Slide Master. |
See also
Office Add-ins