Word.ShapeTextWrapType 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) => {
  // Sets text wrap properties of the first text box.
  const firstShapeWithTextBox: Word.Shape = context.document.body.shapes
    .getByTypes([Word.ShapeType.textBox])
    .getFirstOrNullObject();
  firstShapeWithTextBox.load("textWrap");
  await context.sync();

  if (firstShapeWithTextBox.isNullObject) {
    console.log("No shapes with text boxes found in main document.");
    return;
  }

  const textWrap: Word.ShapeTextWrap = firstShapeWithTextBox.textWrap;
  textWrap.type = Word.ShapeTextWrapType.square;
  textWrap.side = Word.ShapeTextWrapSide.both;

  console.log("The first text box's text wrap properties were updated:", textWrap);
});

字段

behind = "Behind"

将形状放在文字后面。

front = "Front"

将形状放在文字前面。

inline = "Inline"

Places形状与文本对齐。

square = "Square"

将文本正方形环绕形状。

through = "Through"

在形状周围和形状中环绕文本。

tight = "Tight"

使文字紧密地环绕形状。

topBottom = "TopBottom"

将文字放在形状的上方和下方。