forked from telemark/generate-docx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tst.js
54 lines (49 loc) · 955 Bytes
/
tst.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// const { writeFileSync } = require('fs')
const generateDocx = require('./index')
const options = {
template: {
filePath: 'test/data/testdoc.docx',
data: {
title: 'This is the title',
description: 'Description is good',
body: 'My body is my temple'
}
},
save: {
filePath: 'test/data/savedfilenew.docx'
}
}
/*
const options = {
template: {
filePath: 'test/data/testdoc.docx',
data: {
title: 'This is the title',
description: 'Description is good',
body: 'My body is my temple'
}
}
}
*/
generateDocx(options)
.then(console.log)
.catch(console.error)
/*
generateDocx(options, (error, message) => {
if (error) {
console.error(error)
} else {
console.log(message)
}
})
*/
/*
generateDocx(options, (error, buf) => {
if (error) {
console.error(error)
} else {
writeFileSync('test/data/frombuffer.docx', buf)
console.log('File written')
}
})
*/