Edit

Share via


Word.ShapeTextWrapSide enum

Specifies whether the document text should wrap on both sides of the specified shape, on either the left or right side only, or on the side of the shape that's farther from the respective page margin.

Remarks

[ API set: WordApiDesktop 1.2 ]

Examples

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

Fields

both = "Both"

Both left and right sides of the shape.

largest = "Largest"

Side of the shape that's farther from the respective page margin.

left = "Left"

Left side of the shape only.

none = "None"

Has no wrap side property, such as those for inline shapes.

right = "Right"

Right side of the shape only.