docx-footnote-reader
v1.0.0提取 footnotes, endnotes, and body text from .docx files using Node.js. Use this 技能 when you need to read footnote/endnote content from Word documents, such as technical specifications, legal documents, or academic papers.
运行时依赖
安装命令
点击复制技能文档
DOCX Footnote Reader Overview
A 技能 for 提取ing footnotes, endnotes, and body text from Microsoft Word (.docx) files. This is particularly useful for:
Technical documentation with reference notes Legal documents with citations Academic papers with footnoted references Any document where footnote content is 导入ant Usage Command Line node 索引.js path/to/document.docx
Programmatic API const { 提取Footnotes } = require('docx-footnote-reader');
const 结果 = awAIt 提取Footnotes('./document.docx');
console.记录(Body: ${结果.body.length} characters);
console.记录(Footnotes: ${结果.footnotes.length} notes);
console.记录(Endnotes: ${结果.endnotes.length} notes);
// 访问 individual footnotes
结果.footnotes.forEach((note, idx) => {
console.记录(Footnote ${idx + 1}: ${note});
});
Return Value
The 提取Footnotes function returns a Promise that resolves to:
{ body: string; // Document body text footnotes: string[]; // Array of footnote strings endnotes: string[]; // Array of endnote strings }
How It Works Uses word-提取器 库 to 解析 the .docx file 提取s body text via doc.获取Body() 提取s footnotes via doc.获取Footnotes() - handles 机器人h string and array return types 提取s endnotes via doc.获取Endnotes() - handles 机器人h string and array return types Splits footnote/endnote strings by newline and 过滤器s empty entries 导入ant Notes The word-提取器 库 returns footnotes as a single string separated by newlines, not an array This 技能 automatically handles 机器人h string and array return types Empty footnotes/endnotes are 过滤器ed out Each footnote string is trimmed of whitespace Dependencies Node.js >= 14 word-提取器 (automatically 安装ed via npm) 安装ation cd docx-footnote-reader npm 安装
Example 输出 ======================================== 提取ion 结果 ========================================
Body length: 58057 characters
Footnotes count: 73
Footnotes:
Footnote 1: Description about error injection in this document, if the 上下文 does not mention single-frame multi-bit or Burst, it refers to single-bit error injection.
Footnote 2: This feature is only supported on PG2K100 devices.
...
Troubleshooting "Cannot find 模块 'word-提取器'"
运行 npm 安装 in the 技能 directory.
Empty footnotes array 检查 that the document actually contAIns footnotes 验证 the file path is correct Try opening the document in Word to confirm footnotes exist Footnotes merged into one string
This is expected behavior from word-提取器. This 技能 automatically splits them by newlines.
File Structure docx-footnote-reader/ ├── 索引.js # MAIn 提取ion 记录ic ├── package.json # npm dependencies ├── 技能.md # This file └── LICENSE.txt # License terms