次の方法で共有


Word.NumberType enum

リスト内の数値の種類を指定します。

注釈

[ API set: WordApiDesktop 1.3 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/20-lists/format-list-range.yaml

// Counts only the level-1 (top-level) numbered paragraphs in the body range.
await Word.run(async (context) => {
  const bodyRange: Word.Range = context.document.body.getRange();
  const listFormat: Word.ListFormat = bodyRange.listFormat;

  const options: Word.ListFormatCountNumberedItemsOptions = {
    level: 1,
    numberType: Word.NumberType.paragraph,
  };
  const count: OfficeExtension.ClientResult<number> = listFormat.countNumberedItems(options);
  await context.sync();

  console.log(`Level-1 item count: ${count.value}`);
});

フィールド

allNumbers = "AllNumbers"

その他すべての場合の既定値です。

listNum = "ListNum"

ListNum フィールドの既定値

paragraph = "Paragraph"

[ 番号ライブラリ] でテンプレートを選択し、段落に追加できる既定の番号です。