docx-to-html
Documentation / lib/components/Editor/docx/docx-to-html
documentToTokens()​
function documentToTokens(docxInput: string | File | Blob | ArrayBuffer, options: any): Promise<any[]>;
Defined in: apps/web/src/lib/components/Editor/docx/docx-to-html.js:14
Converts docx file to array or token objects with text and formatting 1 - open document.xml and styles.xml by unzipping .docx file 2 - tokenize document.xml and pull info on named styles from styles.xml
Parameters​
Parameter | Type | Description |
---|---|---|
|
| File Path, File object, Blob, or ArrayBuffer of a DOCX file |
|
| simplified: boolean |
Returns​
Promise
<any
[]>
Array of token objects with text and formatting
documentToMarkup()​
function documentToMarkup(filepath: any): Promise<string>;
Defined in: apps/web/src/lib/components/Editor/docx/docx-to-html.js:62
1 - open document.xml 2 - tokenize xml 3 - reconstruct cleaned html
Parameters​
Parameter | Type |
---|---|
|
|
Returns​
Promise
<string
>
createStyleParser()​
function createStyleParser(styleXML: any): Promise<any>;
Defined in: apps/web/src/lib/components/Editor/docx/docx-to-html.js:68
Parameters​
Parameter | Type |
---|---|
|
|
Returns​
Promise
<any
>
createTokenizer()​
function createTokenizer(docXML: string, styleData: any): any[];
Defined in: apps/web/src/lib/components/Editor/docx/docx-to-html.js:118
Parses doc xml to tokenize each text range into obj: text: "", format underline, strong, mark
Parameters​
Parameter | Type | Description |
---|---|---|
|
| string from docx unzip |
|
| parsed object of style class names |
Returns​
any
[]
blocks