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