forked from SerhiiKozachenko/Node-Excel-Export
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
218 lines (193 loc) · 27.1 KB
/
index.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
require('node-zip');
Date.prototype.getJulian = function() {
return Math.floor((this / 86400000) -
(this.getTimezoneOffset()/1440) + 2440587.5);
}
Date.prototype.oaDate = function() {
return (this - new Date(Date.UTC(1899, 12, 29))) / (24 * 60 * 60 * 1000);
}
//var templateXLSX = 'UEsDBAoAAAAIABN7eUK9Z10uOQEAADUEAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbK2US04DMQyGrzLKFk1SWCCEOu0C2EIluECUeDpR81LslvZsLDgSV8CdQQVViALtJlFi+//+PN9eXsfTdfDVCgq6FBtxLkeigmiSdXHeiCW19ZWYTsZPmwxYcWrERnRE+VopNB0EjTJliBxpUwmaeFjmKmuz0HNQF6PRpTIpEkSqaashJuNbaPXSU3W35ukBy+WiuhnytqhG6Jy9M5o4rFbR7kHq1LbOgE1mGbhEYi6gLXYAFLzsexm0i2e9sPqWWcDj36Afq5Jc2edg5zL+hMgYrMn/g5hUoM6Fo4UcfGIe+KyKs1DNdKF7HVhR8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et xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">' +
'<x:sheetPr><x:outlinePr summaryBelow="1" summaryRight="1" /></x:sheetPr>' +
'<x:sheetViews><x:sheetView tabSelected="0" workbookViewId="0" /></x:sheetViews><x:sheetFormatPr defaultRowHeight="15" /><x:sheetData>';
var sheetBack = '</x:sheetData>';
//'<x:hyperlinks>' +
//'<x:hyperlink ref="A1" r:id="rId1"/>' +
//'</x:hyperlinks>' +
var workSheetBack = '<x:pageMargins left="0.75" right="0.75" top="0.75" bottom="0.5" header="0.5" footer="0.75" />' +
'<x:pageSetup paperSize="1" scale="100" pageOrder="downThenOver" orientation="default" blackAndWhite="0" draft="0" cellComments="none" errors="displayed" /><x:headerFooter /><x:tableParts count="0" /></x:worksheet>';
var sheetHyperlinksFront = '<x:hyperlinks>';
var sheetHyperlinksBack = '</x:hyperlinks>';
var hyperlinksCount = 0;
var sharedStringsFront = '<?xml version="1.0" encoding="UTF-8"?><x:sst xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main" uniqueCount="$count" count="$count">';
var sharedStringsBack = '</x:sst>';
var shareStrings;
var sheetRelationshipsFront = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">';
//'<Relationship TargetMode="External" Target="http://urbanapplication.org/DownloadAll/5233fb8094bfd08f35000018" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Id="rId1"/>' +
var sheetRelationshipsBack = '</Relationships>';
exports.executeAsync = function(config, callBack){
return process.nextTick(function(){
var r = exports.execute(config);
callBack(r);
});
}
exports.execute = function(config){
var cols = config.cols,
data = config.rows;
var xlsx = new JSZip(templateXLSX, { base64: true, checkCRC32: false }),
sheet = xlsx.file("xl/worksheets/sheet.xml"),
sheet_rels = xlsx.file("xl/worksheets/_rels/sheet.xml.rels"),
sharedStringsXml = xlsx.file("xl/sharedStrings.xml"),
rows = "",
row ="";
shareStrings = new Array();
//first row for column caption
row = ['<x:row r="1" spans="1:', cols.length , '">'].join('');
var k;
for (k=0; k < cols.length; k++)
{
row = [row, addStringCol(getColumnLetter(k+1)+1, cols[k].caption)].join('');
}
row = [row , '</x:row>'].join('');
rows = [rows , row].join('');
//fill in data
var i, j, r, cellData;
for (i=0;i<data.length;i++)
{
r = data[i], currRow = i+2;
row = ['<x:row r="',currRow,'" spans="1:', cols.length , '">'].join('');
for (j=0; j<cols.length; j++)
{
cellData = r[j];
if (typeof cols[j].beforeCellWrite === 'function')
cellData = cols[j].beforeCellWrite(r, cellData);
switch(cols[j].type)
{
case 'number':
row = [row, addNumberCol(getColumnLetter(j+1)+currRow, cellData)].join('');
break;
case 'date':
row = [row, addDateCol(getColumnLetter(j+1)+currRow, cellData)].join('');
break;
case 'bool':
row = [row, addBoolCol(getColumnLetter(j+1)+currRow, cellData)].join('');
break;
case 'hyperlink':
row = [row, addHyperlinkCol(getColumnLetter(j+1)+currRow, cellData)].join('');
break;
default:
row = [row, addStringCol(getColumnLetter(j+1)+currRow, cellData)].join('');
}
}
row = [row, '</x:row>'].join('');
rows = [rows , row].join('');
}
xlsx.remove(sheet.name);
// Clear sheet_rels template
xlsx.remove(sheet_rels.name);
// Append actual sheet_rels data
if (hyperlinksCount > 0) {
xlsx.file(sheet_rels.name, sheetRelationshipsFront + sheetRelationshipsBack);
xlsx.file(sheet.name, sheetFront + rows + sheetBack + sheetHyperlinksFront + sheetHyperlinksBack + workSheetBack);
} else {
xlsx.file(sheet.name, sheetFront + rows + sheetBack + workSheetBack);
}
if (shareStrings.length >0)
{
xlsx.remove(sharedStringsXml.name);
sharedStringsFront = sharedStringsFront.replace(/\$count/g, shareStrings.length);
xlsx.file(sharedStringsXml.name, sharedStringsFront + convertShareStrings() + sharedStringsBack);
}
var r = xlsx.generate({ base64: false, compression: "DEFLATE" });
delete xlsx;
delete shareStrings;
return r;
}
var addNumberCol = function(cellRef, value){
if (value===null)
return "";
else
return ['<x:c r="',cellRef,'" s="0" t="n"><x:v>',value,'</x:v></x:c>'].join('');
};
var addDateCol = function(cellRef, value){
if (value===null)
return "";
else
return ['<x:c r="',cellRef,'" s="1" t="n"><x:v>',value,'</x:v></x:c>'].join('');
};
var addBoolCol = function(cellRef, value){
if (value===null)
return "";
if (value){
value = 1
} else
value = 0;
return ['<x:c r="',cellRef,'" s="0" t="b"><x:v>',value,'</x:v></x:c>'].join('');
};
var addStringCol = function(cellRef, value){
if (value===null)
return "";
if (typeof value ==='string'){
value = value.replace(/&/g, "&").replace(/'/g, "'").replace(/>/g, ">").replace(/</g, "<");
}
if (shareStrings.indexOf(value) < 0){
shareStrings.push(value);
}
return ['<x:c r="',cellRef,'" s="0" t="s"><x:v>',shareStrings.indexOf(value),'</x:v></x:c>'].join('');
};
var addHyperlinkCol = function(cellRef, value){
if (value===null)
return "";
if (typeof value ==='object'){
var href = value.href;
value.text = value.text.replace(/&/g, "&").replace(/'/g, "'").replace(/>/g, ">").replace(/</g, "<");
// Add to sheet hyperlinks section and Relationships file section
//'<x:hyperlinks>' +
//'<x:hyperlink ref="A1" r:id="rId1"/>' +
//'</x:hyperlinks>' +
//sheetHyperlinksBack = '</x:hyperlinks>';
//var sheetRelationshipsFront = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
// '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">';
//'<Relationship TargetMode="External" Target="http://urbanapplication.org/DownloadAll/5233fb8094bfd08f35000018" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Id="rId1"/>' +
//var sheetRelationshipsBack = '</Relationships>';
hyperlinksCount++
sheetRelationshipsBack = '<Relationship TargetMode="External" Target="'+href+'" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Id="rId'+hyperlinksCount+'"/>' + sheetRelationshipsBack;
sheetHyperlinksBack = '<x:hyperlink ref="'+cellRef+'" r:id="rId'+hyperlinksCount+'"/>' + sheetHyperlinksBack;
}
// if (typeof value ==='string'){
// value = value.replace(/&/g, "&").replace(/'/g, "'").replace(/>/g, ">").replace(/</g, "<");
// }
if (shareStrings.indexOf(value.text) < 0){
shareStrings.push(value.text);
}
return ['<x:c r="',cellRef,'" s="2" t="s"><x:v>',shareStrings.indexOf(value.text),'</x:v></x:c>'].join('');
};
var convertShareStrings = function(){
var r = "", i;
for (i=0;i<shareStrings.length;i++)
{
r = [r , "<x:si><x:t>",shareStrings[i],"</x:t></x:si>"].join('');
}
return r;
};
var getColumnLetter = function(col){
if (col <= 0)
throw "col must be more than 0";
var array = new Array();
while (col > 0)
{
var remainder = col % 26;
col /= 26;
col = Math.floor(col);
if(remainder ===0)
{
remainder = 26;
col--;
}
array.push(64 + remainder);
}
return String.fromCharCode.apply(null, array.reverse());
}