forked from exceljs/exceljs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestWbStreamOut.js
35 lines (30 loc) · 876 Bytes
/
testWbStreamOut.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
const Excel = require('../excel');
const utils = require('../spec/utils/index');
const filename = process.argv[2];
const styles = {
filename,
useStyles: true,
};
const wb = new Excel.stream.xlsx.WorkbookWriter(styles);
const ws = wb.addWorksheet('blort');
const style = {
font: utils.styles.fonts.comicSansUdB16,
alignment: utils.styles.alignments[1].alignment,
};
ws.columns = [
{header: 'A1', width: 10},
{header: 'B1', width: 20, style},
{header: 'C1', width: 30},
];
ws.getRow(2).font = utils.styles.fonts.broadwayRedOutline20;
ws.getCell('A2').value = 'A2';
ws.getCell('B2').value = 'B2';
ws.getCell('C2').value = 'C2';
ws.getCell('A3').value = 'A3';
ws.getCell('B3').value = 'B3';
ws.getCell('C3').value = 'C3';
wb.commit().then(() => {
console.log('Done');
// var wb2 = new Excel.Workbook();
// return wb2.xlsx.readFile('./wb.test2.xlsx');
});