Поделиться через


Word.ShapeType enum

Представляет тип фигуры.

Комментарии

[ Набор API: WordApiDesktop 1.2 ]

Примеры

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/45-shapes/manage-shapes-text-boxes.yaml

await Word.run(async (context) => {
  // Gets text boxes in the main document.
  const shapes: Word.ShapeCollection = context.document.body.shapes;
  shapes.load();
  await context.sync();

  if (shapes.items.length > 0) {
    console.log(`Number of shapes found in the main document: ${shapes.items.length}`);
    shapes.items.forEach(function (shape, index) {
      if (shape.type === Word.ShapeType.textBox) {
        console.log(`Shape ${index} in the main document has a text box. Properties:`, shape);
      } else {
        console.log(`Shape ${index} in the main document doesn't have a text box.`);
      }
    });
  } else {
    console.log("No shapes found in the main document.");
  }
});

Поля

canvas = "Canvas"

Форма холста.

geometricShape = "GeometricShape"

Геометрическая форма.

group = "Group"

Фигура группы.

picture = "Picture"

Фигура рисунка.

textBox = "TextBox"

Фигура текстового поля.

unsupported = "Unsupported"

Неподдерживаемый тип фигуры.