次の方法で共有


Word.RelativeHorizontalPosition enum

図形の水平方向の位置の相対位置を表します。 余白の詳細については、「Word ドキュメントの余白を変更する」を参照してください。

注釈

[ API set: WordApiDesktop 1.2 ]

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

フィールド

character = "Character"

文字を基準にする

column = "Column"

列を基準にする

insideMargin = "InsideMargin"

内側の余白を基準とする。

leftMargin = "LeftMargin"

左余白を基準にする

margin = "Margin"

余白を基準にする

outsideMargin = "OutsideMargin"

外部余白に対する相対値。

page = "Page"

ページを基準にする

rightMargin = "RightMargin"

右余白を基準にする