Merge pull request #229 from microbit-matt-hillsdon/get-started-packer-fix
Fix getting started docs for v4 packer.
This commit is contained in:
@ -29,6 +29,7 @@ import * as docx from "docx";
|
|||||||
## Basic Usage
|
## Basic Usage
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
var fs = require("fs");
|
||||||
var docx = require("docx");
|
var docx = require("docx");
|
||||||
|
|
||||||
// Create document
|
// Create document
|
||||||
@ -41,11 +42,12 @@ paragraph.addRun(new docx.TextRun("Lorem Ipsum Foo Bar"));
|
|||||||
doc.addParagraph(paragraph);
|
doc.addParagraph(paragraph);
|
||||||
|
|
||||||
// Used to export the file into a .docx file
|
// Used to export the file into a .docx file
|
||||||
var exporter = new docx.LocalPacker(doc);
|
var packer = new docx.Packer();
|
||||||
|
packer.toBuffer(doc).then((buffer) => {
|
||||||
|
fs.writeFileSync("My First Document.docx", buffer);
|
||||||
|
});
|
||||||
|
|
||||||
exporter.pack("My First Document");
|
// Done! A file called 'My First Document.docx' will be in your file system.
|
||||||
|
|
||||||
// Done! A file called 'My First Document.docx' will be in your file system if you used LocalPacker
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Honoured Mentions
|
## Honoured Mentions
|
||||||
|
Reference in New Issue
Block a user