PowerPoint.ShapeAddOptions interface

Represents the available options when adding shapes.

Remarks

[ API set: PowerPointApi 1.4 ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/shapes.yaml

// This function gets the collection of shapes on the first slide,
// and adds a hexagon shape to the collection, while specifying its
// location and size. Then it names the shape.
await PowerPoint.run(async (context) => {
  const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
  const shapeOptions: PowerPoint.ShapeAddOptions = {
    left: 100,
    top: 100,
    height: 150,
    width: 150
  };
  const hexagon: PowerPoint.Shape = shapes.addGeometricShape(PowerPoint.GeometricShapeType.hexagon, shapeOptions);
  hexagon.name = "Hexagon";

  await context.sync();
});

Properties

height

Specifies the height, in points, of the shape. When not provided, a default value will be used. Throws an InvalidArgument exception when set with a negative value.

left

Specifies the distance, in points, from the left side of the shape to the left side of the slide. When not provided, a default value will be used.

top

Specifies the distance, in points, from the top edge of the shape to the top edge of the slide. When not provided, a default value will be used.

width

Specifies the width, in points, of the shape. When not provided, a default value will be used. Throws an InvalidArgument exception when set with a negative value.

Property Details

height

Specifies the height, in points, of the shape. When not provided, a default value will be used. Throws an InvalidArgument exception when set with a negative value.

height?: number;

Property Value

number

Remarks

[ API set: PowerPointApi 1.4 ]

left

Specifies the distance, in points, from the left side of the shape to the left side of the slide. When not provided, a default value will be used.

left?: number;

Property Value

number

Remarks

[ API set: PowerPointApi 1.4 ]

top

Specifies the distance, in points, from the top edge of the shape to the top edge of the slide. When not provided, a default value will be used.

top?: number;

Property Value

number

Remarks

[ API set: PowerPointApi 1.4 ]

width

Specifies the width, in points, of the shape. When not provided, a default value will be used. Throws an InvalidArgument exception when set with a negative value.

width?: number;

Property Value

number

Remarks

[ API set: PowerPointApi 1.4 ]