Partager via


Word.RelativeHorizontalPosition enum

Représente la position horizontale d’une forme par rapport. Pour plus d’informations sur les marges, consultez Modifier les marges dans votre document Word.

Remarques

[ Ensemble d’API : WordApiDesktop 1.2 ]

Exemples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/45-shapes/group-ungroup.yaml

await Word.run(async (context) => {
  // Changes the position of the first set of grouped shapes (including text boxes) found in the document body.
  const firstShapeGroup: Word.Shape = context.document.body.shapes
    .getByTypes([Word.ShapeType.group])
    .getFirstOrNullObject();
  firstShapeGroup.load("shapeGroup/shapes");
  await context.sync();

  if (firstShapeGroup.isNullObject) {
    console.log("No shape groups found in the document body.");
    return;
  }

  let shapeGroup: Word.ShapeGroup = firstShapeGroup.shapeGroup;
  console.log("About to change the position of the first shape group found in document body:", shapeGroup.shapes);
  firstShapeGroup.relativeVerticalPosition = Word.RelativeVerticalPosition.insideMargin;
  firstShapeGroup.relativeHorizontalPosition = Word.RelativeHorizontalPosition.margin;

  console.log("Changed the position of the first shape group.");
});

Champs

character = "Character"

Caractère.

column = "Column"

Colonne.

insideMargin = "InsideMargin"

Par rapport à la marge intérieure.

leftMargin = "LeftMargin"

Marge de gauche.

margin = "Margin"

Marge.

outsideMargin = "OutsideMargin"

Par rapport à la marge externe.

page = "Page"

Page.

rightMargin = "RightMargin"

Marge de droite.