@eigenpal/docx-editor-core/docx/parser
Main Parser Orchestrator - Unified parseDocx function
Coordinates all sub-parsers to produce a complete Document model. Handles loading order, dependency resolution, and font preloading.
Parsing order: 1. Unzip DOCX package 2. Parse relationships 3. Parse theme (needed for style color/font resolution) 4. Parse styles (depends on theme) 5. Parse numbering 6. Parse document body (depends on styles, theme, numbering, rels) 7. Parse headers/footers (depends on styles, theme, numbering, rels) 8. Parse footnotes/endnotes (depends on styles, theme, numbering, rels) 9. Extract and load fonts 10. Build media file map 11. Assemble final Document
Functions(5)
fullParseDocx
Full parse - parse everything including fonts
declare function fullParseDocx(buffer: ArrayBuffer, onProgress?: ProgressCallback): Promise<Document>;getDocxSummary
Get document summary without full parsing
declare function getDocxSummary(buffer: ArrayBuffer): Promise<{
hasDocument: boolean;
hasStyles: boolean;
hasTheme: boolean;
hasNumbering: boolean;
headerCount: number;
footerCount: number;
mediaCount: number;
variableCount: number;
}>;getDocxVariables
Get template variables from a DOCX without full parsing Faster than full parse when you only need variables
declare function getDocxVariables(buffer: ArrayBuffer): Promise<string[]>;parseDocx
Parse a DOCX file into a complete Document model
declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;quickParseDocx
Quick parse - parse a DOCX without font loading Useful for quick content extraction or when fonts aren't needed
declare function quickParseDocx(buffer: ArrayBuffer): Promise<Document>;Interfaces(1)
ParseOptions
Parsing options
interface ParseOptions| Member | Type | Summary |
|---|---|---|
| detectVariables? | boolean | Whether to detect template variables (default: true) |
| onProgress? | ProgressCallback | Progress callback for tracking parsing stages |
| parseHeadersFooters? | boolean | Whether to parse headers/footers (default: true) |
| parseNotes? | boolean | Whether to parse footnotes/endnotes (default: true) |
| preloadFonts? | boolean | Whether to preload fonts (default: true) |
Type aliases(1)
ProgressCallback
Progress callback for tracking parsing stages
type ProgressCallback = (stage: string, percent: number) => void;