DOCX

引用

目录、脚注、尾注和参考文献

目录

插入一个可由 Word 应用程序更新的目录域:

{
  "sections": [
    {
      "children": [
        { "paragraph": { "heading": "Heading1", "children": ["Table of Contents"] } },
        { "toc": { "alias": "Table of Contents", "hyperlink": true, "headingStyleRange": "1-3" } }
      ]
    }
  ]
}

脚注

在页面底部添加脚注:

{
  "footnotes": {
    "1": { "children": ["这是第一条脚注。"] },
    "2": { "children": ["这是第二条脚注。"] }
  },
  "sections": [
    {
      "children": [
        {
          "paragraph": {
            "children": [
              "带有脚注的文字",
              { "footnoteReference": 1 },
              " 和另一个",
              { "footnoteReference": 2 },
              ""
            ]
          }
        }
      ]
    }
  ]
}

尾注

尾注出现在文档或节的末尾:

{
  "endnotes": {
    "1": { "children": ["这是一条尾注。"] }
  },
  "sections": [
    {
      "children": [{ "paragraph": { "children": ["带有尾注的文字", { "endnoteReference": 1 }] } }]
    }
  ]
}

参考文献

添加参考文献节用于引用:

import { generateDocument } from "@office-open/docx";

// 参考文献条目通常通过 XML 源定义
// 并通过文档中的引用域进行引用
Copyright © 2026