816cb54b142a5518b700b815802d189b4d4c573d
Rework the way attributes are stored in ImportedXmlComponent to match elsewhere (required allowing for a null xmlKeys in the XmlAttributeComponent interface). Rework the way paragraphs get added to the end of table cells if needed. The goal in both reworks is to not mess around with the objects output from `prepForXml` if we can avoid it. Made the output of RunProperties, ParagraphProperties, TableCellProperties, TableRowProperties, and TableProperties all optional based on whether they contain any attributes or children. Changed code in PageBorders, TableCellMargin, and TableCellBorders that implemented this same thing by overriding `prepForXml` so that it uses the new XmlComponent subclass instead. Removed commented out code that attempted to fix-up XML output and make proper empty elements. Fixed all affected tests. Turn off `no-null-keyword` in the linter as we need to use null to signal to the `xml` library to create an empty element with no attributes (`undefined` will not work in its place). Fixes #306
Easily generate .docx files with JS/TS. Works for Node and on the Browser.
Demo
Browser
Here are examples of docx
being used with basic HTML/JS
in a browser environment:
Here is an example of docx
working in Angular
:
Node
Press endpoint
on the RunKit
website:
- https://runkit.com/dolanmiu/docx-demo1 - Simple paragraph and text
- https://runkit.com/dolanmiu/docx-demo2 - Advanced Paragraphs and text
- https://runkit.com/dolanmiu/docx-demo3 - Bullet points
- https://runkit.com/dolanmiu/docx-demo4 - Simple table
- https://runkit.com/dolanmiu/docx-demo5 - Images
- https://runkit.com/dolanmiu/docx-demo6 - Margins
- https://runkit.com/dolanmiu/docx-demo7 - Landscape
- https://runkit.com/dolanmiu/docx-demo8 - Header and Footer
- https://runkit.com/dolanmiu/docx-demo10 - My CV generated with docx
How to use & Documentation
Please refer to the documentation at https://docx.js.org/ for details on how to use this library, examples and much more!
Examples
Check the examples
section in the documentation and the demo folder for examples.
Contributing
Read the contribution guidelines here.
Used by
Made with 💖
Description
Languages
TypeScript
100%