Word.ShapeTextWrapSide 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);
});

字段

both = "Both"

形状的左侧和右侧。

largest = "Largest"

离相应页边距更远的形状的一侧。

left = "Left"

仅限形状的左侧。

none = "None"

没有环绕侧属性,例如内联形状的那些属性。

right = "Right"

仅限形状的右侧。