forked from exceljs/exceljs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-comments.js
100 lines (97 loc) · 2.36 KB
/
test-comments.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
const Excel = require('../lib/exceljs.nodejs.js');
const wb = new Excel.Workbook();
wb.xlsx
.readFile(require.resolve('./data/comments.xlsx'))
.then(() => {
wb.worksheets.forEach(sheet => {
console.info(sheet.getCell('A1').model);
sheet.getCell('B2').value = 'Zeb';
sheet.getCell('B2').comment = {
texts: [
{
font: {
size: 12,
color: {theme: 0},
name: 'Calibri',
family: 2,
scheme: 'minor',
},
text: 'This is ',
},
{
font: {
italic: true,
size: 12,
color: {theme: 0},
name: 'Calibri',
scheme: 'minor',
},
text: 'a',
},
{
font: {
size: 12,
color: {theme: 1},
name: 'Calibri',
family: 2,
scheme: 'minor',
},
text: ' ',
},
{
font: {
size: 12,
color: {argb: 'FFFF6600'},
name: 'Calibri',
scheme: 'minor',
},
text: 'colorful',
},
{
font: {
size: 12,
color: {theme: 1},
name: 'Calibri',
family: 2,
scheme: 'minor',
},
text: ' text ',
},
{
font: {
size: 12,
color: {argb: 'FFCCFFCC'},
name: 'Calibri',
scheme: 'minor',
},
text: 'with',
},
{
font: {
size: 12,
color: {theme: 1},
name: 'Calibri',
family: 2,
scheme: 'minor',
},
text: ' in-cell ',
},
{
font: {
bold: true,
size: 12,
color: {theme: 1},
name: 'Calibri',
family: 2,
scheme: 'minor',
},
text: 'format',
},
],
};
// sheet.getCell('D2').value = 'Zoo';
// sheet.getCell('D2').comment = 'Plain Text Comment';
});
return wb.xlsx.writeFile(`${__dirname}/data/test.xlsx`);
})
.catch(console.error);