Files
docx-js/docs
2019-03-07 15:32:16 +11:00
..
2019-03-07 15:32:16 +11:00
2019-03-05 21:57:31 +00:00
2019-03-06 00:18:00 +00:00
2018-12-06 14:30:24 +00:00

clippy the assistant

Easily generate .docx files with JS/TS. Works for Node and on the Browser. 💯


Welcome

Installation

npm install --save docx

Then you can require or import as usual:

let docx = require("docx");
import * as docx from "docx";

Basic Usage

var fs = require("fs");
var docx = require("docx");

// Create document
var doc = new docx.Document();

// Add some content in the document
var paragraph = new docx.Paragraph("Some cool text here.");
// Add more text into the paragraph if you wish
paragraph.addRun(new docx.TextRun("Lorem Ipsum Foo Bar"));
doc.addParagraph(paragraph);

// Used to export the file into a .docx file
var packer = new docx.Packer();
packer.toBuffer(doc).then((buffer) => {
    fs.writeFileSync("My First Document.docx", buffer);
});

// Done! A file called 'My First Document.docx' will be in your file system.

Honoured Mentions

@felipeochoa

@h4buli

clippy the assistant


Made with 💖