Edit

Share via


Word.ShapeTextWrapType enum

Specifies how to wrap document text around a shape. For more details, see the "Text Wrapping" tab of Layout options.

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

behind = "Behind"

Places shape behind text.

front = "Front"

Places shape in front of text.

inline = "Inline"

Places the shape in line with text.

square = "Square"

Wraps text squarely around the shape.

through = "Through"

Wraps text around and through the shape.

tight = "Tight"

Wraps text close to the shape.

topBottom = "TopBottom"

Places text above and below the shape.