PowerPoint.PictureAddOptions interface
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Represents the available options when adding a picture (represented by a PowerPoint.Shape object).
Remarks
API set: PowerPointApi BETA (PREVIEW ONLY)
Used by
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/preview-apis/add-picture.yaml
// Insert a picture on the current slide.
await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
// Use PictureAddOptions to control the position and dimensions (in points).
const options: PowerPoint.PictureAddOptions = {
left: 100,
top: 100,
width: 250,
height: 180,
};
const picture: PowerPoint.Shape = slide.shapes.addPicture(getSampleImageBase64(), options);
picture.name = "SamplePicture";
// Set accessibility properties on the inserted picture.
picture.altTextTitle = "Sample image";
picture.altTextDescription = "A cartoon dog image used as a sample picture in this add-in.";
await context.sync();
});
Properties
| height | Specifies the height, in points, of the picture. When not provided, the default value is 72 points (1 inch). Throws an |
| left | Specifies the distance, in points, from the left side of the picture to the left side of the slide. When not provided, the default value is 0. |
| top | Specifies the distance, in points, from the top edge of the picture to the top edge of the slide. When not provided, the default value is 0. |
| width | Specifies the width, in points, of the picture. When not provided, the default value is 72 points (1 inch). Throws an |
Property Details
height
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the height, in points, of the picture. When not provided, the default value is 72 points (1 inch). Throws an InvalidArgument exception when set with a negative value.
height?: number;
Property Value
number
Remarks
left
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the distance, in points, from the left side of the picture to the left side of the slide. When not provided, the default value is 0.
left?: number;
Property Value
number
Remarks
top
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the distance, in points, from the top edge of the picture to the top edge of the slide. When not provided, the default value is 0.
top?: number;
Property Value
number
Remarks
width
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the width, in points, of the picture. When not provided, the default value is 72 points (1 inch). Throws an InvalidArgument exception when set with a negative value.
width?: number;
Property Value
number