Skip to main content

docx-to-html

Documentation / lib/components/Editor/docx/docx-to-html

createStyleParser()​

function createStyleParser(styleXML: any): Promise<any>;

Defined in: web-app/src/lib/components/Editor/docx/docx-to-html.js:70

Parameters​

ParameterType

styleXML

any

Returns​

Promise<any>


createTokenizer()​

function createTokenizer(docXML: string, styleData: any): any[];

Defined in: web-app/src/lib/components/Editor/docx/docx-to-html.js:120

Parses doc xml to tokenize each text range into obj: text: "", format underline, strong, mark

Parameters​

ParameterTypeDescription

docXML

string

string from docx unzip

styleData

any

parsed object of style class names

Returns​

any[]

blocks


documentToMarkup()​

function documentToMarkup(filepath: any): Promise<string>;

Defined in: web-app/src/lib/components/Editor/docx/docx-to-html.js:64

1 - open document.xml 2 - tokenize xml 3 - reconstruct cleaned html

Parameters​

ParameterType

filepath

any

Returns​

Promise<string>


documentToTokens()​

function documentToTokens(docxInput: string | ArrayBuffer | Blob | File, options: any): Promise<any[]>;

Defined in: web-app/src/lib/components/Editor/docx/docx-to-html.js:16

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​

ParameterTypeDescription

docxInput

string | ArrayBuffer | Blob | File

File Path, File object, Blob, or ArrayBuffer of a DOCX file

options

any

simplified: boolean

Returns​

Promise<any[]>

Array of token objects with text and formatting