| 1234567891011121314151617181920212223 |
- import {
- Paragraph,
- TextRun,
- HeadingLevel,
- ParagraphChild
- } from "docx"
- // 本模块主要用于复杂文本标签结构,从中提取#text节点,Element依然由handleElement处理
- export const handleNodes = (nodes: NodeListOf<ChildNode>): ParagraphChild[] => {
- const paragraphChildList: ParagraphChild[] = []
- nodes.forEach((n) => {
- if (n.nodeType === 3) {
- // TEXT节点
- } else if (n.nodeType === 1) {
- // ELEMENT节点
- }
- })
- return new Paragraph({
- children: [new TextRun()],
- spacing: { after: 200 },
- })
- }
|