forked from exceljs/exceljs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestPrintColRowOut.js
46 lines (38 loc) · 963 Bytes
/
testPrintColRowOut.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
const HrStopwatch = require('./utils/hr-stopwatch');
const Excel = require('../excel');
const {Workbook} = Excel;
const [, , filename] = process.argv;
const stopwatch = new HrStopwatch();
stopwatch.start();
const wb = new Workbook();
const ws = wb.addWorksheet('blort');
for (let row = 1; row <= 100; row++) {
const values = [];
if (row === 1) {
values.push('');
for (let col = 2; col <= 100; col++) {
values.push(`Col ${col}`);
}
} else {
for (let col = 1; col <= 100; col++) {
if (col === 1) {
values.push(`Row ${row}`);
} else {
values.push(`${row}-${col}`);
}
}
}
ws.addRow(values);
}
ws.pageSetup.printTitlesColumn = 'A:A';
ws.pageSetup.printTitlesRow = '1:1';
wb.xlsx
.writeFile(filename)
.then(() => {
const micros = stopwatch.microseconds;
console.log('Done.');
console.log('Time taken:', micros);
})
.catch(error => {
console.log(error.message);
});