All Projects → raulbojalil → Docx Builder

raulbojalil / Docx Builder

NPM Module for creating or merging .docx files

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Docx Builder

Wedge
可配置的小说下载及电子书生成工具
Stars: ✭ 62 (+463.64%)
Mutual labels:  docx, nodejs-modules
Mastodon Api
Mastodon API Client Library
Stars: ✭ 89 (+709.09%)
Mutual labels:  node-module, nodejs-modules
Node Ebml
EBML parser
Stars: ✭ 66 (+500%)
Mutual labels:  node-module, nodejs-modules
Pm2 Slack
A PM2 module to emit events to Slack
Stars: ✭ 124 (+1027.27%)
Mutual labels:  node-module, nodejs-modules
vayder
Easy and concise validations for Express routes
Stars: ✭ 26 (+136.36%)
Mutual labels:  node-module, nodejs-modules
Openwrt Node Packages
OpenWrt Project Node.js packages. v10.x LTS and v12.x LTS and v14.x LTS
Stars: ✭ 176 (+1500%)
Mutual labels:  node-module, nodejs-modules
Meetup Api
meetup-api is an Meetup.com API library written in JavaScript for Node.js V8 and Node.js ChakraCore
Stars: ✭ 104 (+845.45%)
Mutual labels:  node-module, nodejs-modules
node-screenlogic
Pentair ScreenLogic Javascript library using Node.JS
Stars: ✭ 38 (+245.45%)
Mutual labels:  node-module, nodejs-modules
Modclean
Remove unwanted files and directories from your node_modules folder
Stars: ✭ 309 (+2709.09%)
Mutual labels:  node-module, nodejs-modules
Figures
Unicode symbols with Windows CMD fallbacks
Stars: ✭ 438 (+3881.82%)
Mutual labels:  node-module
Koodo Reader
A modern ebook manager and reader with sync and backup capacities for Windows, macOS, Linux and Web
Stars: ✭ 2,938 (+26609.09%)
Mutual labels:  docx
Docx Templates
Template-based docx report creation
Stars: ✭ 382 (+3372.73%)
Mutual labels:  docx
Node Libcurl
libcurl bindings for Node.js
Stars: ✭ 447 (+3963.64%)
Mutual labels:  node-module
Kodexplorer
A web based file manager,web IDE / browser based code editor
Stars: ✭ 5,490 (+49809.09%)
Mutual labels:  docx
Fiduswriter
Fidus Writer is an online collaborative editor for academics.
Stars: ✭ 405 (+3581.82%)
Mutual labels:  docx
Shopify Api Node
Official Node Shopify connector sponsored by MONEI.net
Stars: ✭ 695 (+6218.18%)
Mutual labels:  node-module
Practicalnode
Practical Node.js, 1st and 2nd Editions [Apress] 📓
Stars: ✭ 3,694 (+33481.82%)
Mutual labels:  node-module
Multipages Generator
🥇 generator for multiple pages webpack application
Stars: ✭ 354 (+3118.18%)
Mutual labels:  node-module
Docconv
Converts PDF, DOC, DOCX, XML, HTML, RTF, etc to plain text
Stars: ✭ 735 (+6581.82%)
Mutual labels:  docx
Node Module Boilerplate
Boilerplate to kickstart creating a Node.js module
Stars: ✭ 668 (+5972.73%)
Mutual labels:  node-module

docx-builder

An NPM module for creating and/or merging DOCX files.

How to install

Using npm do:

npm install docx-builder

View in npm

Example

var builder = require('docx-builder');
var docx = new builder.Document();

//SET THE HEADER

docx.beginHeader();
docx.insertText("This is the header");
docx.endHeader();

//SET THE FOOTER

docx.beginFooter();
docx.insertText("This is the footer");
docx.endFooter();

//COMMON OPERATIONS

docx.setBold();
docx.unsetBold();
docx.setItalic();
docx.unsetItalic();
docx.setUnderline();
docx.unsetUnderline();
docx.setFont("Arial");
docx.setSize(40);
docx.rightAlign();
docx.centerAlign();
docx.leftAlign();
docx.insertText("Hello");

//INSERT A TABLE

docx.beginTable({ borderColor: "red", borderSize: 20 });
docx.insertRow();
docx.setItalic();
docx.setUnderline();
docx.insertText("ID");
docx.nextColumn();
docx.insertText("Username");
docx.nextRow();
docx.insertText("1");
docx.nextColumn();
docx.insertText("raulb");
docx.endTable();

//INSERT EXTERNAL FILES

docx.insertDocxSync(__dirname+"/test.docx");
docx.insertPageBreak();
docx.insertDocx(__dirname+"/test2.docx", function(err){
	if(err) console.log(err);
});

//SAVE THE DOCX FILE

docx.save(__dirname + "/output.docx", function(err){
	if(err) console.log(err);
});

Merging .docx files

A common requirement is to merge two or more .docx files into one. For that, just call insertDocxSync or insertDocx to append the content of your .docx files.

var builder = require('docx-builder');
var docx = new builder.Document();

//You can also do this asynchronously using the insertDocx method.
docx.insertDocxSync(__dirname+"/test1.docx"); 
docx.insertDocxSync(__dirname+"/test2.docx");
docx.insertDocxSync(__dirname+"/test3.docx");

//SAVING THE DOCX FILE

docx.save(__dirname + "/output.docx", function(err){
	if(err) console.log(err);
});

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].