excellentexport 3.9.11 → 3.9.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,395 +1,401 @@
1
-
2
- [![Node CI](https://github.com/jmaister/excellentexport/actions/workflows/webpack.yml/badge.svg?branch=master)](https://github.com/jmaister/excellentexport/actions/workflows/webpack.yml)
3
- [![](https://data.jsdelivr.com/v1/package/npm/excellentexport/badge)](https://www.jsdelivr.com/package/npm/excellentexport)
4
- [![codecov](https://codecov.io/gh/jmaister/excellentexport/graph/badge.svg?token=CMhCN0GnmY)](https://codecov.io/gh/jmaister/excellentexport)
5
-
6
- # ExcellentExport.js
7
-
8
- - [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
9
-
10
- - JavaScript export to Excel or CSV.
11
-
12
- - A quick JavaScript library to create export to Excel/CSV from HTML tables in the browser. No server required.
13
-
14
- - As part of the new version 3.0.0+, there is support for _XLSX_. The drawback is that the library is 200+ KB.
15
-
16
- - Check My Blog Page for Testing :
17
- [JavaScript export to Excel](http://jordiburgos.com/post/2013/javascript-export-to-excel.html)
18
-
19
- [ExcellentExport.js update: JavaScript export to Excel and CSV](http://jordiburgos.com/post/2017/excellentexport-javascript-export-to-excel-csv.html)
20
-
21
- # Revision history:
22
-
23
- ### 3.9.11
24
-
25
- * _Update npm dependencies to fix vulnerabilities_
26
-
27
- ### 3.9.10
28
-
29
- * Add ts-node dependency for TypeScript development support.
30
- * _Update npm dependencies to fix vulnerabilities_
31
-
32
- ### 3.9.9
33
-
34
- * Configure codecov to track code coverage.
35
- * Removed coveralls, the library used is too old, not updated in years and has many vulnerabilities.
36
- * Remove unused dependencies (there was a lot of them).
37
-
38
- ### 3.9.8
39
-
40
- * _Update npm dependencies to fix vulnerabilities_
41
- * Moving to npm build (package-lock.json), yarn does not support "audit fix" command to fix dependencies vulnerabilities automatically.
42
-
43
- ### 3.9.7
44
-
45
- * _Update npm dependencies to fix vulnerabilities_
46
- * xlsx package loaded from CDN [SheetJS CDN](https://cdn.sheetjs.com/)
47
-
48
- ### 3.9.6
49
-
50
- * Remove references to openbase.io
51
- * Fix typos
52
- * _Update npm dependencies to fix vulnerabilities_
53
-
54
- ### 3.9.5
55
-
56
- * _Update npm dependencies to fix vulnerabilities_
57
-
58
- ### 3.9.4
59
-
60
- * _Update npm dependencies to fix vulnerabilities_
61
-
62
- ### 3.9.3
63
-
64
- * Fix TypeScript exported types
65
-
66
- ### 3.9.0
67
-
68
- * Cell types and formats!!! Now you can define the cell type and format. For example, you can define a cell as a date or a number. You can also define the format of the cell. For example, you can define a cell as a date with the format "dd/mm/yyyy" or a number with the format "#,##0.00".
69
-
70
- ### 3.8.1
71
-
72
- * Activate XLSX compression by default. The example of index.bigtable.html went from 18Mb to 3Mb.
73
- * _Update npm dependencies to fix vulnerabilities_
74
- * Update to latest version of TypeScript
75
- * Reduced size of the library from 912 KB to 277 KB!!!
76
-
77
- ### 3.8.0
78
-
79
- * Allow RTL options on the whole file or sheet.
80
- * _Update npm dependencies to fix vulnerabilities_
81
-
82
- ### 3.7.3
83
-
84
- * Fix (#591) remove columns parameter. Now it is not affected by repeated column numbers nor its order.
85
-
86
- ### 3.7.2
87
-
88
- * _Update npm dependencies to fix vulnerabilities_
89
-
90
- ### 3.7.1
91
-
92
- * _Update npm dependencies to fix vulnerabilities_
93
- * Start using Dependabot and get rid of Dependabot-preview
94
-
95
- ### 3.7.0
96
-
97
- * Added option `openAsDownload: boolean`. Use this option to download as a file without using an anchor tag. So download can be triggered from a button.
98
- * _Update npm dependencies to fix vulnerabilities_
99
-
100
- ### 3.6.0
101
-
102
- * Added sponsor link to the project [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
103
- * Transform the project from JavaScript to TypeScript
104
- * Configure Jest as test runner
105
- * _Update npm dependencies to fix vulnerabilities_
106
-
107
- ### 3.5.0
108
-
109
- * Add fixValue and fixArray functions to configuration: these configuration functions can be used to manipulate the values of the cells.
110
- * _Update npm dependencies to fix vulnerabilities_
111
-
112
- ### 3.4.3
113
-
114
- * _Update npm dependencies to fix vulnerabilities_
115
-
116
- ### 3.4.2
117
-
118
- * Remove ES6 function syntax to support IE11
119
- * _Update npm dependencies to fix vulnerabilities_
120
-
121
- ### 3.4.0
122
-
123
- * Configure TravisCI on GitHub
124
- * Update npm dependencies to fix vulnerabilities
125
-
126
- ### 3.3.0
127
-
128
- * Remove columns by index
129
- * Filter rows by value
130
- * _Updated build to Webpack 4.x.x_
131
-
132
- ### 3.2.1
133
-
134
- * _Update npm dependencies to fix vulnerabilities_
135
-
136
- ### 3.2.0
137
-
138
- * _Update npm dependencies to fix vulnerabilities_
139
-
140
- ### 3.1.0
141
-
142
- * Fix old API for base64 and escaping problem.
143
-
144
- ### 3.0.0
145
-
146
- * XLSX support. This bumps the build size to 640 KB.
147
- * New API : ExcellentExport.convert(...)
148
- * Autogenerate download filename.
149
- * Data input from arrays or HTML Tables.
150
- * Multiple sheets for XLS or XLSX formats.
151
-
152
- ### 2.1.0
153
-
154
- * Add Webpack build.
155
- * Create UMD JavaScript module. Library can be loaded as a module (import, RequireJS, AMD, etc...) or standalone as window.ExcellentExport.
156
-
157
- ### 2.0.3
158
-
159
- * Fix export as a module.
160
- * Changed minifier to UglifyJS.
161
-
162
- ### 2.0.2
163
-
164
- * Fix CSV Chinese characters and other special characters display error in Windows Excel.
165
- * Fix URL.createObjectURL(...) on Firefox.
166
-
167
-
168
- ### 2.0.0
169
-
170
- * Now it can export to big files +2MB.
171
- * Minimum IE 11.
172
- * Links open with URL.createObjectURL(...).
173
- * NPM package available.
174
- * Using Semantic versioning (2.0.0 instead of 2.0).
175
- * Module can be loaded standalone or with RequireJS.
176
- * Change license to MIT.
177
-
178
- ### 1.5
179
-
180
- * Possibility to select a CSV delimiter.
181
- * Bower package available.
182
- * Compose package available.
183
-
184
- ### 1.4
185
-
186
- * _Add LICENSE.txt with GPL v3_
187
- * UTF-8 characters fixed.
188
-
189
- ### 1.3
190
-
191
- * _Added minified version_
192
-
193
- ### 1.1
194
-
195
- * _Added CSV data export_
196
-
197
- ### 1.0
198
-
199
- * _Added Excel data export_
200
-
201
- ## Compatibility
202
-
203
- - Firefox
204
- - Chrome
205
- - Internet Explorer 11+
206
-
207
- # Install
208
-
209
- ## npm
210
-
211
- npm install excellentexport --save
212
-
213
- ## yarn
214
-
215
- yarn add excellentexport
216
-
217
- ## bower
218
-
219
- bower install excellentexport
220
-
221
- # Load
222
-
223
-
224
- **Include script in your HTML:**
225
-
226
- <script type="text/javascript" src="dist/excellentexport.js"></script>
227
-
228
- **Include script in your HTML using CDN:**
229
-
230
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/excellentexport@3.4.3/dist/excellentexport.min.js"></script>
231
-
232
-
233
- **Require.js**
234
-
235
- <script src="http://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
236
- <script>
237
- require(['dist/excellentexport'], function(ee) {
238
- window.ExcellentExport = ee;
239
- });
240
- </script>
241
-
242
- **ES6 import**
243
-
244
- import ExcellentExport from 'excellentexport';
245
-
246
-
247
- # Usage
248
-
249
- <table id="datatable">
250
- <tr>
251
- <td>100</td> <td>200</td> <td>300</td>
252
- </tr>
253
- <tr>
254
- <td>400</td> <td>500</td> <td>600</td>
255
- </tr>
256
- </table>
257
-
258
- <a download="somedata.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
259
- <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV</a>
260
- <!-- new API, xlsx -->
261
- <a download="somedata.xlsx" href="#" onclick="return ExcellentExport.convert({ anchor: this, filename: 'data_123.array', format: 'xlsx'},[{name: 'Sheet Name Here 1', from: {table: 'datatable'}}]);">Export to CSV</a>
262
-
263
- # API
264
-
265
- ExcellentExport.convert(options, sheets);
266
-
267
- Options:
268
- {
269
- anchor: String or HTML Element,
270
- format: 'xlsx' or 'xls' or 'csv',
271
- filename: String,
272
- rtl: Use Right-to-left characters, boolean (optional)
273
- }
274
-
275
- Sheets must be an array of sheet configuration objects. Sheet description:
276
- [
277
- {
278
- name: 'Sheet 1', // Sheet name
279
- from: {
280
- table: String/Element, // Table ID or table element
281
- array: [...] // Array with the data. Array where each element is a row. Every row is an array of the cells.
282
- },
283
- removeColumns: [...], // Array of column indexes (from 0)
284
- filterRowFn: function(row) {return true}, // Function to decide which rows are returned
285
- fixValue: function(value, row, column) {return fixedValue} // Function to fix values, receiving value, row num, column num
286
- fixArray: function(array) {return array} // Function to manipulate the whole data array
287
- rtl: Use Right-to-left characters, boolean (optional)
288
- formats: [...] // Array of formats for each column. See formats below.
289
- ...
290
- },
291
- {
292
- ...
293
- }, ...
294
- ]
295
-
296
- ## fixValue example
297
-
298
- This is an example for the _fixValue function_ to handle HTML tags inside a table cell.
299
- It transforms BR to line breaks and then strips all the HTML tags.
300
-
301
- fixValue: (value, row, col) => {
302
- let v = value.replace(/<br>/gi, "\n");
303
- let strippedString = v.replace(/(<([^>]+)>)/gi, "");
304
- return strippedString;
305
- }
306
-
307
- ## Formats
308
-
309
- You can specify an array with the formats for a specific cell range (i.e. A1:A100, A1:D100, A1:H1, etc).
310
-
311
- Each element in the format array consists on:
312
-
313
- ```typescript
314
- const sheet01 = {
315
- "range": "A1:A100", // Range of cells to apply the format, mandatory
316
- "format": {
317
- "type": "<cell_type>", // Type of format, mandatory
318
- "pattern": "<pattern>" // Pattern, optional
319
- }
320
- }
321
- ```
322
-
323
- Example:
324
-
325
- ```typescript
326
- formats: [
327
- {
328
- range: "C2:C20",
329
- format: {
330
- type: "n",
331
- pattern: "0.00",
332
- },
333
- },
334
- {
335
- range: "C2:C20",
336
- format: ExcellentExport.formats.NUMBER,
337
- }
338
- ]
339
- ```
340
-
341
- `format` can be used from one of the predefined types if you use TypeScript
342
-
343
-
344
- `cell_type` can be one of the followint:
345
-
346
- 's': String
347
- 'n': Number
348
- 'd': Date
349
- 'b': Boolean
350
-
351
- `pattern` is a string with the format pattern used in Excel. For example:
352
-
353
- '0' // Integer
354
- '0.00' // 2 decimals
355
- 'dd/mm/yyyy' // Date
356
- 'dd/mm/yyyy hh:mm:ss' // Date and time
357
- '0.00%' // Percentage
358
- '0.00e+00' // Scientific notation
359
- '@' // Text
360
-
361
- # Notes
362
-
363
- - IE8 or lower do not support *data:* url schema.
364
- - IE9 does not support *data:* url schema on links.
365
- - IE10 and above and Edge are supported via the Microsoft-specific `msOpenOrSaveBlob` method.
366
-
367
- # Test
368
-
369
- python 2.x:
370
- python -m SimpleHTTPServer 8000
371
-
372
- python 3.x:
373
- python -m http.server 8000
374
-
375
- # Build
376
-
377
- **Install dependencies:**
378
-
379
- npm install
380
-
381
- **Build development version dist/excellentexport.js**
382
-
383
- npm run build
384
-
385
- **Build publish version of dist/excellentexport.js**
386
-
387
- npm run prod
388
-
389
- **Publish**
390
-
391
- npm publish
392
-
393
- ## Dependencies
394
-
395
- - XLSX is not available from NPM anymore. Use https://cdn.sheetjs.com/ to install it.
1
+
2
+ [![Node CI](https://github.com/jmaister/excellentexport/actions/workflows/webpack.yml/badge.svg?branch=master)](https://github.com/jmaister/excellentexport/actions/workflows/webpack.yml)
3
+ [![](https://data.jsdelivr.com/v1/package/npm/excellentexport/badge)](https://www.jsdelivr.com/package/npm/excellentexport)
4
+ [![codecov](https://codecov.io/gh/jmaister/excellentexport/graph/badge.svg?token=CMhCN0GnmY)](https://codecov.io/gh/jmaister/excellentexport)
5
+
6
+ # ExcellentExport.js
7
+
8
+ - [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
9
+
10
+ - JavaScript export to Excel or CSV.
11
+
12
+ - A quick JavaScript library to create export to Excel/CSV from HTML tables in the browser. No server required.
13
+
14
+ - As part of the new version 3.0.0+, there is support for _XLSX_. The drawback is that the library is 200+ KB.
15
+
16
+ - Check My Blog Page for Testing :
17
+ [JavaScript export to Excel](http://jordiburgos.com/post/2013/javascript-export-to-excel.html)
18
+
19
+ [ExcellentExport.js update: JavaScript export to Excel and CSV](http://jordiburgos.com/post/2017/excellentexport-javascript-export-to-excel-csv.html)
20
+
21
+ # Revision history:
22
+
23
+ ### 3.9.15
24
+
25
+ * Moved build to Vite 8 and Vitest. Test went from 12 seconds to 0.5 seconds!!!
26
+ * Added support for rowspan and colspan. Now you can export tables with merged cells.
27
+ * _Update npm dependencies to fix vulnerabilities_
28
+
29
+ ### 3.9.11
30
+
31
+ * _Update npm dependencies to fix vulnerabilities_
32
+
33
+ ### 3.9.10
34
+
35
+ * Add ts-node dependency for TypeScript development support.
36
+ * _Update npm dependencies to fix vulnerabilities_
37
+
38
+ ### 3.9.9
39
+
40
+ * Configure codecov to track code coverage.
41
+ * Removed coveralls, the library used is too old, not updated in years and has many vulnerabilities.
42
+ * Remove unused dependencies (there was a lot of them).
43
+
44
+ ### 3.9.8
45
+
46
+ * _Update npm dependencies to fix vulnerabilities_
47
+ * Moving to npm build (package-lock.json), yarn does not support "audit fix" command to fix dependencies vulnerabilities automatically.
48
+
49
+ ### 3.9.7
50
+
51
+ * _Update npm dependencies to fix vulnerabilities_
52
+ * xlsx package loaded from CDN [SheetJS CDN](https://cdn.sheetjs.com/)
53
+
54
+ ### 3.9.6
55
+
56
+ * Remove references to openbase.io
57
+ * Fix typos
58
+ * _Update npm dependencies to fix vulnerabilities_
59
+
60
+ ### 3.9.5
61
+
62
+ * _Update npm dependencies to fix vulnerabilities_
63
+
64
+ ### 3.9.4
65
+
66
+ * _Update npm dependencies to fix vulnerabilities_
67
+
68
+ ### 3.9.3
69
+
70
+ * Fix TypeScript exported types
71
+
72
+ ### 3.9.0
73
+
74
+ * Cell types and formats!!! Now you can define the cell type and format. For example, you can define a cell as a date or a number. You can also define the format of the cell. For example, you can define a cell as a date with the format "dd/mm/yyyy" or a number with the format "#,##0.00".
75
+
76
+ ### 3.8.1
77
+
78
+ * Activate XLSX compression by default. The example of index.bigtable.html went from 18Mb to 3Mb.
79
+ * _Update npm dependencies to fix vulnerabilities_
80
+ * Update to latest version of TypeScript
81
+ * Reduced size of the library from 912 KB to 277 KB!!!
82
+
83
+ ### 3.8.0
84
+
85
+ * Allow RTL options on the whole file or sheet.
86
+ * _Update npm dependencies to fix vulnerabilities_
87
+
88
+ ### 3.7.3
89
+
90
+ * Fix (#591) remove columns parameter. Now it is not affected by repeated column numbers nor its order.
91
+
92
+ ### 3.7.2
93
+
94
+ * _Update npm dependencies to fix vulnerabilities_
95
+
96
+ ### 3.7.1
97
+
98
+ * _Update npm dependencies to fix vulnerabilities_
99
+ * Start using Dependabot and get rid of Dependabot-preview
100
+
101
+ ### 3.7.0
102
+
103
+ * Added option `openAsDownload: boolean`. Use this option to download as a file without using an anchor tag. So download can be triggered from a button.
104
+ * _Update npm dependencies to fix vulnerabilities_
105
+
106
+ ### 3.6.0
107
+
108
+ * Added sponsor link to the project [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
109
+ * Transform the project from JavaScript to TypeScript
110
+ * Configure Jest as test runner
111
+ * _Update npm dependencies to fix vulnerabilities_
112
+
113
+ ### 3.5.0
114
+
115
+ * Add fixValue and fixArray functions to configuration: these configuration functions can be used to manipulate the values of the cells.
116
+ * _Update npm dependencies to fix vulnerabilities_
117
+
118
+ ### 3.4.3
119
+
120
+ * _Update npm dependencies to fix vulnerabilities_
121
+
122
+ ### 3.4.2
123
+
124
+ * Remove ES6 function syntax to support IE11
125
+ * _Update npm dependencies to fix vulnerabilities_
126
+
127
+ ### 3.4.0
128
+
129
+ * Configure TravisCI on GitHub
130
+ * Update npm dependencies to fix vulnerabilities
131
+
132
+ ### 3.3.0
133
+
134
+ * Remove columns by index
135
+ * Filter rows by value
136
+ * _Updated build to Webpack 4.x.x_
137
+
138
+ ### 3.2.1
139
+
140
+ * _Update npm dependencies to fix vulnerabilities_
141
+
142
+ ### 3.2.0
143
+
144
+ * _Update npm dependencies to fix vulnerabilities_
145
+
146
+ ### 3.1.0
147
+
148
+ * Fix old API for base64 and escaping problem.
149
+
150
+ ### 3.0.0
151
+
152
+ * XLSX support. This bumps the build size to 640 KB.
153
+ * New API : ExcellentExport.convert(...)
154
+ * Autogenerate download filename.
155
+ * Data input from arrays or HTML Tables.
156
+ * Multiple sheets for XLS or XLSX formats.
157
+
158
+ ### 2.1.0
159
+
160
+ * Add Webpack build.
161
+ * Create UMD JavaScript module. Library can be loaded as a module (import, RequireJS, AMD, etc...) or standalone as window.ExcellentExport.
162
+
163
+ ### 2.0.3
164
+
165
+ * Fix export as a module.
166
+ * Changed minifier to UglifyJS.
167
+
168
+ ### 2.0.2
169
+
170
+ * Fix CSV Chinese characters and other special characters display error in Windows Excel.
171
+ * Fix URL.createObjectURL(...) on Firefox.
172
+
173
+
174
+ ### 2.0.0
175
+
176
+ * Now it can export to big files +2MB.
177
+ * Minimum IE 11.
178
+ * Links open with URL.createObjectURL(...).
179
+ * NPM package available.
180
+ * Using Semantic versioning (2.0.0 instead of 2.0).
181
+ * Module can be loaded standalone or with RequireJS.
182
+ * Change license to MIT.
183
+
184
+ ### 1.5
185
+
186
+ * Possibility to select a CSV delimiter.
187
+ * Bower package available.
188
+ * Compose package available.
189
+
190
+ ### 1.4
191
+
192
+ * _Add LICENSE.txt with GPL v3_
193
+ * UTF-8 characters fixed.
194
+
195
+ ### 1.3
196
+
197
+ * _Added minified version_
198
+
199
+ ### 1.1
200
+
201
+ * _Added CSV data export_
202
+
203
+ ### 1.0
204
+
205
+ * _Added Excel data export_
206
+
207
+ ## Compatibility
208
+
209
+ - Firefox
210
+ - Chrome
211
+ - Internet Explorer 11+
212
+
213
+ # Install
214
+
215
+ ## npm
216
+
217
+ npm install excellentexport --save
218
+
219
+ ## yarn
220
+
221
+ yarn add excellentexport
222
+
223
+ ## bower
224
+
225
+ bower install excellentexport
226
+
227
+ # Load
228
+
229
+
230
+ **Include script in your HTML:**
231
+
232
+ <script type="text/javascript" src="dist/excellentexport.js"></script>
233
+
234
+ **Include script in your HTML using CDN:**
235
+
236
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/excellentexport@3.4.3/dist/excellentexport.min.js"></script>
237
+
238
+
239
+ **Require.js**
240
+
241
+ <script src="http://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
242
+ <script>
243
+ require(['dist/excellentexport'], function(ee) {
244
+ window.ExcellentExport = ee;
245
+ });
246
+ </script>
247
+
248
+ **ES6 import**
249
+
250
+ import ExcellentExport from 'excellentexport';
251
+
252
+
253
+ # Usage
254
+
255
+ <table id="datatable">
256
+ <tr>
257
+ <td>100</td> <td>200</td> <td>300</td>
258
+ </tr>
259
+ <tr>
260
+ <td>400</td> <td>500</td> <td>600</td>
261
+ </tr>
262
+ </table>
263
+
264
+ <a download="somedata.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
265
+ <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV</a>
266
+ <!-- new API, xlsx -->
267
+ <a download="somedata.xlsx" href="#" onclick="return ExcellentExport.convert({ anchor: this, filename: 'data_123.array', format: 'xlsx'},[{name: 'Sheet Name Here 1', from: {table: 'datatable'}}]);">Export to CSV</a>
268
+
269
+ # API
270
+
271
+ ExcellentExport.convert(options, sheets);
272
+
273
+ Options:
274
+ {
275
+ anchor: String or HTML Element,
276
+ format: 'xlsx' or 'xls' or 'csv',
277
+ filename: String,
278
+ rtl: Use Right-to-left characters, boolean (optional)
279
+ }
280
+
281
+ Sheets must be an array of sheet configuration objects. Sheet description:
282
+ [
283
+ {
284
+ name: 'Sheet 1', // Sheet name
285
+ from: {
286
+ table: String/Element, // Table ID or table element
287
+ array: [...] // Array with the data. Array where each element is a row. Every row is an array of the cells.
288
+ },
289
+ removeColumns: [...], // Array of column indexes (from 0)
290
+ filterRowFn: function(row) {return true}, // Function to decide which rows are returned
291
+ fixValue: function(value, row, column) {return fixedValue} // Function to fix values, receiving value, row num, column num
292
+ fixArray: function(array) {return array} // Function to manipulate the whole data array
293
+ rtl: Use Right-to-left characters, boolean (optional)
294
+ formats: [...] // Array of formats for each column. See formats below.
295
+ ...
296
+ },
297
+ {
298
+ ...
299
+ }, ...
300
+ ]
301
+
302
+ ## fixValue example
303
+
304
+ This is an example for the _fixValue function_ to handle HTML tags inside a table cell.
305
+ It transforms BR to line breaks and then strips all the HTML tags.
306
+
307
+ fixValue: (value, row, col) => {
308
+ let v = value.replace(/<br>/gi, "\n");
309
+ let strippedString = v.replace(/(<([^>]+)>)/gi, "");
310
+ return strippedString;
311
+ }
312
+
313
+ ## Formats
314
+
315
+ You can specify an array with the formats for a specific cell range (i.e. A1:A100, A1:D100, A1:H1, etc).
316
+
317
+ Each element in the format array consists on:
318
+
319
+ ```typescript
320
+ const sheet01 = {
321
+ "range": "A1:A100", // Range of cells to apply the format, mandatory
322
+ "format": {
323
+ "type": "<cell_type>", // Type of format, mandatory
324
+ "pattern": "<pattern>" // Pattern, optional
325
+ }
326
+ }
327
+ ```
328
+
329
+ Example:
330
+
331
+ ```typescript
332
+ formats: [
333
+ {
334
+ range: "C2:C20",
335
+ format: {
336
+ type: "n",
337
+ pattern: "0.00",
338
+ },
339
+ },
340
+ {
341
+ range: "C2:C20",
342
+ format: ExcellentExport.formats.NUMBER,
343
+ }
344
+ ]
345
+ ```
346
+
347
+ `format` can be used from one of the predefined types if you use TypeScript
348
+
349
+
350
+ `cell_type` can be one of the followint:
351
+
352
+ 's': String
353
+ 'n': Number
354
+ 'd': Date
355
+ 'b': Boolean
356
+
357
+ `pattern` is a string with the format pattern used in Excel. For example:
358
+
359
+ '0' // Integer
360
+ '0.00' // 2 decimals
361
+ 'dd/mm/yyyy' // Date
362
+ 'dd/mm/yyyy hh:mm:ss' // Date and time
363
+ '0.00%' // Percentage
364
+ '0.00e+00' // Scientific notation
365
+ '@' // Text
366
+
367
+ # Notes
368
+
369
+ - IE8 or lower do not support *data:* url schema.
370
+ - IE9 does not support *data:* url schema on links.
371
+ - IE10 and above and Edge are supported via the Microsoft-specific `msOpenOrSaveBlob` method.
372
+
373
+ # Test
374
+
375
+ python 2.x:
376
+ python -m SimpleHTTPServer 8000
377
+
378
+ python 3.x:
379
+ python -m http.server 8000
380
+
381
+ # Build
382
+
383
+ **Install dependencies:**
384
+
385
+ npm install
386
+
387
+ **Build development version dist/excellentexport.js**
388
+
389
+ npm run build
390
+
391
+ **Build publish version of dist/excellentexport.js**
392
+
393
+ npm run prod
394
+
395
+ **Publish**
396
+
397
+ npm publish
398
+
399
+ ## Dependencies
400
+
401
+ - XLSX is not available from NPM anymore. Use https://cdn.sheetjs.com/ to install it.