Word.InsertShapeOptions interface

指定用于在插入形状时确定位置和大小的选项。

注解

[ API 集:WordApiDesktop 1.2 ]

示例

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

await Word.run(async (context) => {
  // Inserts a text box at the beginning of the selection.
  const range: Word.Range = context.document.getSelection();
  const insertShapeOptions: Word.InsertShapeOptions = {
    top: 0,
    left: 0,
    height: 100,
    width: 100
  };

  const newTextBox: Word.Shape = range.insertTextBox("placeholder text", insertShapeOptions);
  await context.sync();

  console.log("Inserted a text box at the beginning of the current selection.");
});

属性

height

表示要插入的形状的高度。

left

表示要插入的形状的左侧位置。

top

表示要插入的形状的顶部位置。

width

表示要插入的形状的宽度。

属性详细信息

height

表示要插入的形状的高度。

height?: number;

属性值

number

注解

[ API 集:WordApiDesktop 1.2 ]

left

表示要插入的形状的左侧位置。

left?: number;

属性值

number

注解

[ API 集:WordApiDesktop 1.2 ]

top

表示要插入的形状的顶部位置。

top?: number;

属性值

number

注解

[ API 集:WordApiDesktop 1.2 ]

width

表示要插入的形状的宽度。

width?: number;

属性值

number

注解

[ API 集:WordApiDesktop 1.2 ]