Generate .docx files with JS/TS very easily, written in TS.
$ npm install --save docx
endpoint on the
- 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-demo6 - Margins
- https://runkit.com/dolanmiu/docx-demo7 - Landscape
- https://runkit.com/dolanmiu/docx-demo8/1.0.1 - Header and Footer
- https://runkit.com/dolanmiu/docx-demo10 - My CV generated with docx
Run demos locally:
$ npm run demo
This command will run the demo selector app in the
demo folder. It will prompt you to select a demo number, which will run a demo from that folder.
Please refer to the Wiki for details on how to use this library, examples and much more!
Full documentation can be found here: http://dolanmiu.github.io/docx/index.html
// Used to create docx filesvar docx = ;// Create documentvar doc = ;// Add some content in the documentvar paragraph = "Some cool text here.";// Add more text into the paragraph if you wishparagraph;doc;// Used to export the file into a .docx filevar exporter = doc;// Or use the express packer to make the file downloadable.// res is express' Response objectvar exporter = doc res;exporter;// If you want to export it as a .pdf file insteadexporter;// done! A file called 'My First Document.docx'// will be in your file system if you used LocalPacker// Or it will start downloading if you are using Express
Check the Wiki for examples.
Read the contribution guidelines here.
Made with 💖
Huge thanks to @felipeochoa for awesome contributions to this project