Edit

Share via


PowerPoint.PlaceholderType enum

Specifies the type of a placeholder.

Remarks

[ API set: PowerPointApi 1.8 ]

Examples

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

// Gets the placeholder shapes in the slide.
await PowerPoint.run(async (context) => {
  // Get properties for every shape in the collection.
  const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
  shapes.load("type,name");
  await context.sync();

  const placeholderShapes = [];
  console.log(`Number of shapes found: ${shapes.items.length}`);
  shapes.items.forEach((shape) => {
    if (shape.type === PowerPoint.ShapeType.placeholder) {
      // Load placeholderFormat property.
      // PowerPoint throws an exception if you try to load this property on a shape that isn't a placeholder type.
      shape.load("placeholderFormat");
      placeholderShapes.push(shape);
    }
  });
  await context.sync();

  console.log(`Number of placeholder shapes found: ${placeholderShapes.length}`);
  for (let i = 0; i < placeholderShapes.length; i++) {
    let currentPlaceholder: PowerPoint.PlaceholderFormat = placeholderShapes[i].placeholderFormat;
    let placeholderType = currentPlaceholder.type as PowerPoint.PlaceholderType;
    let placeholderContainedType = currentPlaceholder.containedType as PowerPoint.ShapeType;
    console.log(`Shape "${placeholderShapes[i].name}" placeholder properties:`);
    console.log(`\ttype: ${placeholderType}`);
    console.log(`\tcontainedType: ${placeholderContainedType}`);
  }
});

Fields

body = "Body"

The placeholder is for a body.

cameo = "Cameo"

The placeholder is for a cameo.

centerTitle = "CenterTitle"

The placeholder is for a center title.

chart = "Chart"

The placeholder is for a chart.

content = "Content"

The placeholder is for generic content.

date = "Date"

The placeholder is for a date.

footer = "Footer"

The placeholder is for a footer.

header = "Header"

The placeholder is for a header.

media = "Media"

The placeholder is for media.

onlinePicture = "OnlinePicture"

The placeholder is for an online picture.

picture = "Picture"

The placeholder is for a picture.

slideNumber = "SlideNumber"

The placeholder is for a slide number.

smartArt = "SmartArt"

The placeholder is for a SmartArt.

subtitle = "Subtitle"

The placeholder is for a subtitle.

table = "Table"

The placeholder is for a table.

title = "Title"

The placeholder is for a title.

unsupported = "Unsupported"

The placeholder is unsupported.

verticalBody = "VerticalBody"

The placeholder is for a vertical body.

verticalContent = "VerticalContent"

The placeholder is for generic vertical content.

verticalTitle = "VerticalTitle"

The placeholder is for a vertical title.