Create, Modify & Convert Microsoft® Word DOCX Documents via Open Source APIs.
What is Officegen-DOCX?
It also supports several Word processing features for Microsoft Word document (DOCX file) such as creating Word document, add one or more paragraphs, add images, header and footer support, bookmarks and hyperlinks support.
At A Glance
An overview of Officegen-DOCX features.
- DOCX Creation
- Add Paragraphs
- Set fonts
- Set colors
- Text alignment
- Add images
- header & footer support
- Bookmarks support
- Hyperlinks support
Officegen-DOCX only requires Java run-time.
Getting Started with Officegen-DOCX
The most recent release of officegen-DOCX can be installed directly from the online Officegen-DOCX repository by applying the following command.
Install using officegen repository
$ npm install Ziv-Barber/officegen#master
- Instantiate officegen
- Create an empty Word document
- Set output path & save document
const officegen = require('officegen') const fs = require('fs') // Create an empty Word document let docx = officegen('docx') // Set output path let out = fs.createWriteStream('empty.docx') // Save docx.generate(out)
Inserting Images to Word DOCX Files
const officegen = require('officegen') const fs = require('fs') // Create a new word document let docx = officegen('docx') // Create a new paragraph let pObj = docx.createP() // Add Image pObj.addImage('sample.jpg') // Set output path let out = fs.createWriteStream('image.docx') // Save docx.generate(out)
Add Paragraphs to Word DOCX Files
const officegen = require('officegen') const fs = require('fs') // Create a new word document let docx = officegen('docx') // Add Paragraph let pObj = docx.createP() // Add Text in it pObj.addText('FileFormat Developer Guide') // Set output path let out = fs.createWriteStream('fileformat.docx') // Save docx.generate(out)