forked from exceljs/exceljs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testWbStreamCompressionOptions.js
102 lines (87 loc) · 2.49 KB
/
testWbStreamCompressionOptions.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const Excel = require('../excel');
const utils = require('../spec/utils/index');
const filename = process.argv[2];
console.log(filename);
const optionsBestCompression = {
filename,
useStyles: true,
zip: {
zlib: {level: 9}, // Sets the compression level.
},
};
const wb = new Excel.stream.xlsx.WorkbookWriter(optionsBestCompression);
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');
});
const filename2 = process.argv[3];
console.log(filename2);
const optionsBestSpeed = {
filename: filename2,
useStyles: true,
zip: {
zlib: {level: 1}, // Sets the compression level.
},
};
const wb2 = new Excel.stream.xlsx.WorkbookWriter(optionsBestSpeed);
const ws2 = wb2.addWorksheet('blort');
ws2.columns = [
{header: 'A1', width: 10},
{header: 'B1', width: 20, style},
{header: 'C1', width: 30},
];
ws2.getRow(2).font = utils.styles.fonts.broadwayRedOutline20;
ws2.getCell('A2').value = 'A2';
ws2.getCell('B2').value = 'B2';
ws2.getCell('C2').value = 'C2';
ws2.getCell('A3').value = 'A3';
ws2.getCell('B3').value = 'B3';
ws2.getCell('C3').value = 'C3';
wb2.commit().then(() => {
console.log('Done');
// var wb2 = new Excel.Workbook();
// return wb2.xlsx.readFile('./wb.test2.xlsx');
});
const filename3 = process.argv[4];
console.log(filename3);
const options = {
filename: filename3,
useStyles: true,
};
const wb3 = new Excel.stream.xlsx.WorkbookWriter(options);
const ws3 = wb3.addWorksheet('blort');
ws3.columns = [
{header: 'A1', width: 10},
{header: 'B1', width: 20, style},
{header: 'C1', width: 30},
];
ws3.getRow(2).font = utils.styles.fonts.broadwayRedOutline20;
ws3.getCell('A2').value = 'A2';
ws3.getCell('B2').value = 'B2';
ws3.getCell('C2').value = 'C2';
ws3.getCell('A3').value = 'A3';
ws3.getCell('B3').value = 'B3';
ws3.getCell('C3').value = 'C3';
wb3.commit().then(() => {
console.log('Done');
// var wb2 = new Excel.Workbook();
// return wb2.xlsx.readFile('./wb.test2.xlsx');
});