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 |
---|---|---|
Binding | delete() | Deletes the binding. |
getShape() | Returns the shape represented by the binding. | |
id | Represents the binding identifier. | |
type | Returns the type of the binding. | |
BindingCollection | add(shape: PowerPoint.Shape, bindingType: PowerPoint.BindingType, id: string) | Adds a new binding to a particular Shape. |
addFromSelection(bindingType: PowerPoint.BindingType, id: string) | Adds a new binding based on the current selection. | |
getCount() | Gets the number of bindings in the collection. | |
getItem(key: string) | Gets a binding object by ID. | |
getItemAt(index: number) | Gets a binding object based on its position in the items array. | |
getItemOrNullObject(id: string) | Gets a binding object by ID. | |
items | Gets the loaded child items in this collection. | |
BorderProperties | color | Represents the line color in the hexadecimal format #RRGGBB (e.g., "FFA500") or as a named HTML color value (e.g., "orange"). |
dashStyle | Represents the dash style of the line. | |
transparency | Specifies the transparency percentage of the line as a value from 0.0 (opaque) through 1.0 (clear). | |
weight | Represents the weight of the line, in points. | |
FillProperties | color | Represents the shape fill color in the hexadecimal format #RRGGBB (e.g., "FFA500") or as a named HTML color value (e.g., "orange"). |
transparency | Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). | |
FontProperties | allCaps | Represents whether the font uses all caps, where lowercase letters are shown as capital letters. |
bold | Represents the bold status of font. | |
color | Represents the HTML color in the hexadecimal format (e.g., "#FF0000" represents red) or as a named HTML color value (e.g., "red"). | |
doubleStrikethrough | Represents the double-strikethrough status of the font. | |
italic | Represents the italic status of font. | |
name | Represents the font name (e.g., "Calibri"). | |
size | Represents the font size in points (e.g., 11). | |
smallCaps | Represents whether the text uses small caps, where lowercase letters are shown as small capital letters. | |
strikethrough | Represents the strikethrough status of the font. | |
subscript | Represents the subscript status of the font. | |
superscript | Represents the superscript status of the font. | |
underline | Type of underline applied to the font. | |
PlaceholderFormat | containedType | Gets the type of the shape contained within the placeholder. |
type | Returns the type of this placeholder. | |
Presentation | bindings | Returns a collection of bindings that are associated with the presentation. |
Shape | getTable() | Returns the Table object if this shape is a table. |
group | Returns the ShapeGroup associated with the shape. |
|
level | Returns the level of the specified shape. | |
parentGroup | Returns the parent group of this shape. | |
placeholderFormat | Returns the properties that apply specifically to this placeholder. | |
setZOrder(position: PowerPoint.ShapeZOrder) | Moves the specified shape up or down the collection's z-order, which shifts it in front of or behind other shapes. | |
zOrderPosition | Returns the z-order position of the shape, with 0 representing the bottom of the order stack. | |
ShapeCollection | addGroup(values: Array<string | Shape>) | Create a shape group for several shapes. |
addTable(rowCount: number, columnCount: number, options?: PowerPoint.TableAddOptions) | Adds a table to the slide. | |
ShapeFill | setImage(base64EncodedImage: string) | Sets the fill formatting of the shape to an image. |
ShapeFont | allCaps | Specifies whether the text in the TextRange is set to use the All Caps attribute which makes lowercase letters appear as uppercase letters. |
doubleStrikethrough | Specifies whether the text in the TextRange is set to use the Double strikethrough attribute. |
|
smallCaps | Specifies whether the text in the TextRange is set to use the Small Caps attribute which makes lowercase letters appear as small uppercase letters. |
|
strikethrough | Specifies whether the text in the TextRange is set to use the Strikethrough attribute. |
|
subscript | Specifies whether the text in the TextRange is set to use the Subscript attribute. |
|
superscript | Specifies whether the text in the TextRange is set to use the Superscript attribute. |
|
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. |
Table | columnCount | Gets the number of columns in the table. |
getCellOrNullObject(rowIndex: number, columnIndex: number) | Gets the cell at the specified rowIndex and columnIndex . |
|
getMergedAreas() | Gets a collection of cells that represent the merged areas of the table. | |
getShape() | Gets the shape object for the table. | |
rowCount | Gets the number of rows in the table. | |
values | Gets all of the values in the table. | |
TableAddOptions | columns | If provided, specifies properties for each column in the table. |
height | Specifies the height, in points, of the table. | |
left | Specifies the distance, in points, from the left side of the table to the left side of the slide. | |
mergedAreas | If specified, represents an rectangular area where multiple cells appear as a single cell. | |
rows | If provided, specifies properties for each row in the table. | |
specificCellProperties | If provided, specifies properties for each cell in the table. | |
top | Specifies the distance, in points, from the top edge of the table to the top edge of the slide. | |
uniformCellProperties | Specifies the formatting which applies uniformly to all of the table cells. | |
values | If provided, specifies the values for the table. | |
width | Specifies the width, in points, of the table. | |
TableCell | columnCount | Gets the number of table columns this cell spans across. |
columnIndex | Gets the zero-based column index of the cell within the table. | |
rowCount | Gets the number of table rows this cell spans across. | |
rowIndex | Gets the zero-based row index of the cell within the table. | |
text | Specifies the text content of the table cell. | |
TableCellBorders | bottom | Represents the bottom border. |
diagonalDown | Represents the diagonal border (top-left to bottom-right). | |
diagonalUp | Represents the diagonal border (bottom-left to top-right). | |
left | Represents the left border. | |
right | Represents the right border. | |
top | Represents the top border. | |
TableCellCollection | getCount() | Gets the number of table cells in the collection. |
getItemAtOrNullObject(row: number, column: number) | Gets the table cell using its zero-based index in the collection. | |
items | Gets the loaded child items in this collection. | |
TableCellMargins | bottom | Specifies the bottom margin in points. |
left | Specifies the left margin in points. | |
right | Specifies the right margin in points. | |
top | Specifies the top margin in points. | |
TableCellProperties | borders | Specifies the border formatting of the table cell. |
fill | Specifies the fill formatting of the table cell. | |
font | Specifies the font formatting of the table cell. | |
horizontalAlignment | Represents the horizontal alignment of the table cell. | |
indentLevel | Represents the indent level of the text in the table cell. | |
margins | Specifies the margin settings in the table cell. | |
text | Specifies the text content of the table cell. | |
textRuns | Specifies the contents of the table cell as an array of TextRun objects. | |
verticalAlignment | Represents the vertical alignment of the table cell. | |
TableColumnProperties | columnWidth | Represents the desired width of each column in points, or is undefined. |
TableMergedAreaProperties | columnCount | Specifies the number of columns for the merged cells area. |
columnIndex | Specifies the zero-based index of the column of the top left cell of the merged area. | |
rowCount | Specifies the number of rows for the merged cells area. | |
rowIndex | Specifies the zero-based index of the row of the top left cell of the merged area. | |
TableRowProperties | rowHeight | Represents the desired height of each row in points, or is undefined. |
TextRun | font | The font attributes (such as font name, font size, and color) applied to this text run. |
text | The text of this text run. |