# docxjs **Repository Path**: checkp2p/docxjs ## Basic Information - **Project Name**: docxjs - **Description**: No description available - **Primary Language**: JavaScript - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-03 - **Last Updated**: 2024-04-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [](https://www.npmjs.com/package/docx-preview) [](https://war.ukraine.ua/) # docxjs Docx rendering library Demo - https://volodymyrbaydalka.github.io/docxjs/ Goal ---- Goal of this project is to render/convert DOCX document into HTML document with keeping HTML semantic as much as possible. That means library is limited by HTML capabilities (for example Google Docs renders *.docx document on canvas as an image). Installation ----- ``` npm install docx-preview ``` Usage ----- ```html
... ... ``` API --- ```ts // renders document into specified element renderAsync( document: Blob | ArrayBuffer | Uint8Array, // could be any type that supported by JSZip.loadAsync bodyContainer: HTMLElement, //element to render document content, styleContainer: HTMLElement, //element to render document styles, numbeings, fonts. If null, bodyContainer will be used. options: { className: string = "docx", //class name/prefix for default and document style classes inWrapper: boolean = true, //enables rendering of wrapper around document content ignoreWidth: boolean = false, //disables rendering width of page ignoreHeight: boolean = false, //disables rendering height of page ignoreFonts: boolean = false, //disables fonts rendering breakPages: boolean = true, //enables page breaking on page breaks ignoreLastRenderedPageBreak: boolean = true, //disables page breaking on lastRenderedPageBreak elements experimental: boolean = false, //enables experimental features (tab stops calculation) trimXmlDeclaration: boolean = true, //if true, xml declaration will be removed from xml documents before parsing useBase64URL: boolean = false, //if true, images, fonts, etc. will be converted to base 64 URL, otherwise URL.createObjectURL is used renderChanges: false, //enables experimental rendering of document changes (inserions/deletions) renderHeaders: true, //enables headers rendering renderFooters: true, //enables footers rendering renderFootnotes: true, //enables footnotes rendering renderEndnotes: true, //enables endnotes rendering renderComments: false, //enables experimental comments rendering debug: boolean = false, //enables additional logging }): Promise