Word.BorderWidth enum

注意

此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。

表示样式边框的宽度。

注解

[ API 集:WordApi BETA (仅预览版) ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/manage-styles.yaml

// Updates border properties (e.g., type, width, color) of the specified style.
await Word.run(async (context) => {
  const styleName = $("#style-name").val() as string;
  if (styleName == "") {
    console.warn("Enter a style name to update border properties.");
    return;
  }

  const style = context.document.getStyles().getByNameOrNullObject(styleName);
  style.load();
  await context.sync();

  if (style.isNullObject) {
    console.warn(`There's no existing style with the name '${styleName}'.`);
  } else {
    const borders = style.borders;
    borders.load("items");
    await context.sync();

    borders.outsideBorderType = Word.BorderType.dashed;
    borders.outsideBorderWidth = Word.BorderWidth.pt025;
    borders.outsideBorderColor = "green";
    console.log("Updated outside borders.");
  }
});

字段

mixed = "Mixed"

混合宽度。

none = "None"

无宽度。

pt025 = "Pt025"

0.25 磅。

pt050 = "Pt050"

0.50 磅。

pt075 = "Pt075"

0.75 磅。

pt100 = "Pt100"

1.00 磅。 这是默认选项。

pt150 = "Pt150"

1.50 磅。

pt225 = "Pt225"

2.25 磅。

pt300 = "Pt300"

3.00 磅。

pt450 = "Pt450"

4.50 磅。

pt600 = "Pt600"

6.00 磅。