PowerPoint.PlaceholderType enum

指定占位符的类型。

注解

[ API 集:PowerPointApi 1.8 ]

示例

// 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}`);
  }
});

字段

body = "Body"

占位符用于正文。

cameo = "Cameo"

占位符用于主场。

centerTitle = "CenterTitle"

占位符用于中心标题。

chart = "Chart"

占位符用于图表。

content = "Content"

占位符用于泛型内容。

date = "Date"

占位符用于日期。

footer = "Footer"

占位符用于页脚。

header = "Header"

占位符用于标头。

media = "Media"

占位符用于媒体。

onlinePicture = "OnlinePicture"

占位符用于联机图片。

picture = "Picture"

占位符用于图片。

slideNumber = "SlideNumber"

占位符用于幻灯片编号。

smartArt = "SmartArt"

占位符用于 SmartArt。

subtitle = "Subtitle"

占位符用于副标题。

table = "Table"

占位符用于表。

title = "Title"

占位符用于标题。

unsupported = "Unsupported"

占位符不受支持。

verticalBody = "VerticalBody"

占位符用于垂直正文。

verticalContent = "VerticalContent"

占位符适用于泛型垂直内容。

verticalTitle = "VerticalTitle"

占位符用于垂直标题。