Word.Alignment enum

注解

[ API 集:WordApi 1.1 ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/25-paragraph/paragraph-properties.yaml

await Word.run(async (context) => {
  const body = context.document.body;
  body.clear();
  body.insertParagraph(
    "Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document.",
    "Start"
  );
  body.paragraphs
    .getLast()
    .insertText(
      "To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.",
      "Replace"
    );
  body.paragraphs.getFirst().alignment = "Left";
  body.paragraphs.getLast().alignment = Word.Alignment.left;
});

字段

centered = "Centered"

与中心对齐。

justified = "Justified"

完全对齐对齐。

left = "Left"

向左对齐。

mixed = "Mixed"
right = "Right"

向右对齐。

unknown = "Unknown"

未知的对齐方式。