import AdmZip from "adm-zip"; export interface TOCItem { level: number; text: string; paragraphIndex: number; } export interface TOCResult { title: string; level: number; paragraphIndex: number; headingIndex: number; } export interface StyleDefinition { styleName: string; outlineLvl: number | null; } export interface DocxParseResult { zip: AdmZip; docXml: any; styles: Record; tocItems: TOCItem[]; paragraphs: any[]; } export interface Table { head: TableRow; body: TableRow[]; } export interface TableRow { cells: TableCell[]; } export interface TableCell { text: string; } /** * 解析DOCX文件并提取目录 * @param docxPath - DOCX文件路径 * @returns 包含目录项和文档结构的对象 */ export declare function extractTOCFromDocx(docxPath: string): Promise; /** * 获取段落的大纲级别 * @param paragraph - 段落对象 * @param styles - 样式定义对象 * @returns 大纲级别(1-9为标题级别,0为普通段落) */ export declare function getParagraphOutlineLevel(paragraph: any, styles: Record): number; /** * 1. 获取指定docx文件的目录,返回目录标题、目录级别、目录的段落index * @param docxPath - DOCX文件路径 * @returns 目录项数组 */ export declare function getDocxTOC(docxPath: string): Promise; /** * 2. 获取指定目录下的所有文本(包括表格内容转换为CSV) * @param docxPath - DOCX文件路径 * @param headingIndex - 标题在目录中的索引位置(从0开始) * @returns 目录下的所有文本(段落文本和表格的CSV内容) */ export declare function getTextUnderHeading(docxPath: string, headingIndex: number): Promise; /** * 3. 在指定目录的文本段落最后,附加指定的placeholder文本的段落 * @param docxPath - DOCX文件路径 * @param headingIndex - 标题在目录中的索引位置(从0开始) * @param placeholder - 占位符文本 * @param outputPath - 输出文件路径 * @returns 处理后的文件路径 */ export declare function addPlaceholderAfterHeading(docxPath: string, headingIndex: number, placeholder?: string, outputPath?: string): Promise; export declare function getImagePlaceholderText(imagePath: string): string; /** * 3. 在指定目录的文本段落最后,添加图片 * @param docxPath - DOCX文件路径 * @param headingIndex - 标题在目录中的索引位置(从0开始) * @param placeholder - 占位符文本 * @param outputPath - 输出文件路径 * @returns 处理后的文件路径 */ export declare function addImageAfterHeading(docxPath: string, headingIndex: number, imagePath: string, outputPath?: string): Promise; export declare function addTableAfterHeading(docxPath: string, headingIndex: number, table: Table, outputPath?: string): Promise; /** * 插入同级标题(完全复制参考标题样式) * @param docxPath - DOCX文件路径 * @param options - 插入选项 * @param outputPath - 输出文件路径 * @returns 处理后的文件路径 */ export declare function insertHeading(docxPath: string, options: { text: string; headingIndex: number; insertPosition?: "before" | "after"; }, outputPath?: string): Promise; //# sourceMappingURL=docx-toc-utils.d.ts.map