forked from harshankur/officeParser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
97 lines (93 loc) · 2.42 KB
/
Copy pathindex.ts
File metadata and controls
97 lines (93 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
* officeparser - Universal Office Document Parser
*
* A comprehensive Node.js library for parsing Microsoft Office and OpenDocument files
* into structured Abstract Syntax Trees (AST) with full formatting information.
*
* **Supported Formats:**
* - Microsoft Office: DOCX, XLSX, PPTX (Office Open XML)
* - OpenDocument: ODT, ODP, ODS (ODF)
* - Legacy: RTF (Rich Text Format)
* - Portable: PDF
*
* **Key Features:**
* - Unified AST output across all formats
* - Rich text formatting (bold, italic, colors, fonts, etc.)
* - Document structure (headings, lists, tables)
* - Image extraction with optional OCR
* - Metadata extraction
* - TypeScript support with full type definitions
*
* **Quick Start:**
* ```typescript
* import { OfficeParser } from 'officeparser';
*
* const ast = await OfficeParser.parseOffice('document.docx', {
* extractAttachments: true,
* ocr: true,
* includeRawContent: false
* });
*
* console.log(ast.toText()); // Plain text output
* console.log(ast.content); // Structured content tree
* console.log(ast.metadata); // Document metadata
* ```
*
* **Main Exports:**
* - `OfficeParser` - Main parser class
* - `OfficeParserConfig` - Configuration interface
* - `OfficeParserAST` - AST result interface
* - `OfficeContentNode` - Content tree node interface
* - All type definitions
*
* @packageDocumentation
* @module officeparser
*/
import { OfficeParser } from './OfficeParser.js';
import {
OfficeParserConfig,
OfficeParserAST,
OfficeContentNode,
OfficeAttachment,
OfficeMetadata,
TextFormatting,
SupportedFileType,
OfficeContentNodeType,
OfficeMimeType,
SlideMetadata,
SheetMetadata,
HeadingMetadata,
ListMetadata,
CellMetadata,
ImageMetadata,
PageMetadata,
ContentMetadata,
BreakMetadata,
} from './types';
const parseOffice = OfficeParser.parseOffice;
const terminateOcr = OfficeParser.terminateOcr;
export {
OfficeParser,
parseOffice,
terminateOcr,
OfficeParserConfig,
OfficeParserAST,
OfficeContentNode,
OfficeAttachment,
OfficeMetadata,
TextFormatting,
SupportedFileType,
OfficeContentNodeType,
OfficeMimeType,
SlideMetadata,
SheetMetadata,
HeadingMetadata,
ListMetadata,
CellMetadata,
ImageMetadata,
PageMetadata,
ContentMetadata,
BreakMetadata,
};
// Default export for backward compatibility
export default OfficeParser;