excellentexport 3.7.0 → 3.8.0
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/.github/FUNDING.yml +1 -1
- package/.github/dependabot.yml +7 -0
- package/.github/workflows/webpack.yml +28 -0
- package/LICENSE.txt +20 -20
- package/README.md +286 -266
- package/bower.json +32 -32
- package/dist/excellentexport.d.ts +35 -33
- package/dist/excellentexport.js +2 -1
- package/dist/excellentexport.js.LICENSE.txt +3 -0
- package/dist/utils.d.ts +29 -0
- package/index.bigtable.html +80 -80
- package/index.filters.html +63 -63
- package/index.html +127 -127
- package/index.noanchor.html +31 -31
- package/index.rtl.html +69 -0
- package/jest.config.ts +203 -203
- package/package.json +60 -56
- package/src/excellentexport.ts +203 -335
- package/src/utils.ts +141 -0
- package/test/convert-filters.test.ts +70 -70
- package/test/convert-table.test.ts +71 -71
- package/test/fixdata.test.ts +74 -74
- package/test/utils.test.ts +29 -0
- package/test/utils_fixdata.test.ts +24 -0
- package/test/utils_removeColumns.test.ts +98 -0
- package/tsconfig.json +17 -17
- package/webpack.config.js +4 -1
- package/.travis.yml +0 -9
package/.github/FUNDING.yml
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
github: jmaister
|
|
1
|
+
github: jmaister
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Node CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
node-version: [14.x, 16.x]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v2
|
|
20
|
+
|
|
21
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
22
|
+
uses: actions/setup-node@v1
|
|
23
|
+
with:
|
|
24
|
+
node-version: ${{ matrix.node-version }}
|
|
25
|
+
|
|
26
|
+
- run: yarn install
|
|
27
|
+
|
|
28
|
+
- run: yarn jest
|
package/LICENSE.txt
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2016-2019 Jordi Burgos
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016-2019 Jordi Burgos
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,266 +1,286 @@
|
|
|
1
|
-
|
|
2
|
-
[](https://www.jsdelivr.com/package/npm/excellentexport)
|
|
4
|
-
[](https://openbase.io/js/excellentexport?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
|
|
5
|
-
[](https://coveralls.io/github/jmaister/excellentexport?branch=master)
|
|
6
|
-
|
|
7
|
-
# ExcellentExport.js
|
|
8
|
-
|
|
9
|
-
- [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
|
|
10
|
-
|
|
11
|
-
- JavaScript export to Excel or CSV.
|
|
12
|
-
|
|
13
|
-
- A quick JavaScript library to create export to Excel/CSV from HTML tables in the browser. No server required.
|
|
14
|
-
|
|
15
|
-
- As part of the new version 3.0.0+, there is support for _XLSX_. The drawback is that the library is 600+ KB.
|
|
16
|
-
|
|
17
|
-
- If you only need _XLS_ or _CSV_, use _2.X.X_ versions.
|
|
18
|
-
|
|
19
|
-
- Check My Blog Page for Testing :
|
|
20
|
-
[JavaScript export to Excel](http://jordiburgos.com/post/2013/javascript-export-to-excel.html)
|
|
21
|
-
|
|
22
|
-
[ExcellentExport.js update: JavaScript export to Excel and CSV](http://jordiburgos.com/post/2017/excellentexport-javascript-export-to-excel-csv.html)
|
|
23
|
-
|
|
24
|
-
# Revision history:
|
|
25
|
-
|
|
26
|
-
### 3.
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
* _Update npm dependencies to fix vulnerabilities_
|
|
30
|
-
|
|
31
|
-
### 3.
|
|
32
|
-
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* _Update npm dependencies to fix vulnerabilities_
|
|
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
|
-
### 3.
|
|
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
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
1
|
+
|
|
2
|
+
[](https://github.com/jmaister/excellentexport/actions/workflows/webpack.yml)
|
|
3
|
+
[](https://www.jsdelivr.com/package/npm/excellentexport)
|
|
4
|
+
[](https://openbase.io/js/excellentexport?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
|
|
5
|
+
[](https://coveralls.io/github/jmaister/excellentexport?branch=master)
|
|
6
|
+
|
|
7
|
+
# ExcellentExport.js
|
|
8
|
+
|
|
9
|
+
- [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
|
|
10
|
+
|
|
11
|
+
- JavaScript export to Excel or CSV.
|
|
12
|
+
|
|
13
|
+
- A quick JavaScript library to create export to Excel/CSV from HTML tables in the browser. No server required.
|
|
14
|
+
|
|
15
|
+
- As part of the new version 3.0.0+, there is support for _XLSX_. The drawback is that the library is 600+ KB.
|
|
16
|
+
|
|
17
|
+
- If you only need _XLS_ or _CSV_, use _2.X.X_ versions.
|
|
18
|
+
|
|
19
|
+
- Check My Blog Page for Testing :
|
|
20
|
+
[JavaScript export to Excel](http://jordiburgos.com/post/2013/javascript-export-to-excel.html)
|
|
21
|
+
|
|
22
|
+
[ExcellentExport.js update: JavaScript export to Excel and CSV](http://jordiburgos.com/post/2017/excellentexport-javascript-export-to-excel-csv.html)
|
|
23
|
+
|
|
24
|
+
# Revision history:
|
|
25
|
+
|
|
26
|
+
### 3.8.0
|
|
27
|
+
|
|
28
|
+
* Allow RTL options on the whole file or sheet.
|
|
29
|
+
* _Update npm dependencies to fix vulnerabilities_
|
|
30
|
+
|
|
31
|
+
### 3.7.3
|
|
32
|
+
|
|
33
|
+
* Fix (#591) remove columns parameter. Now it is not affected by repeated column numbers nor its order.
|
|
34
|
+
|
|
35
|
+
### 3.7.2
|
|
36
|
+
|
|
37
|
+
* _Update npm dependencies to fix vulnerabilities_
|
|
38
|
+
|
|
39
|
+
### 3.7.1
|
|
40
|
+
|
|
41
|
+
* _Update npm dependencies to fix vulnerabilities_
|
|
42
|
+
* Start using Dependabot and get rid of Dependabot-preview
|
|
43
|
+
|
|
44
|
+
### 3.7.0
|
|
45
|
+
|
|
46
|
+
* 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.
|
|
47
|
+
* _Update npm dependencies to fix vulnerabilities_
|
|
48
|
+
|
|
49
|
+
### 3.6.0
|
|
50
|
+
|
|
51
|
+
* Added sponsor link to the project [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
|
|
52
|
+
* Transform the project from JavaScript to TypeScript
|
|
53
|
+
* Configure Jest as test runner
|
|
54
|
+
* _Update npm dependencies to fix vulnerabilities_
|
|
55
|
+
|
|
56
|
+
### 3.5.0
|
|
57
|
+
|
|
58
|
+
* Add fixValue and fixArray functions to configuration: these configuration functions can be used to manipulate the values of the cells.
|
|
59
|
+
* _Update npm dependencies to fix vulnerabilities_
|
|
60
|
+
|
|
61
|
+
### 3.4.3
|
|
62
|
+
|
|
63
|
+
* _Update npm dependencies to fix vulnerabilities_
|
|
64
|
+
|
|
65
|
+
### 3.4.2
|
|
66
|
+
|
|
67
|
+
* Remove ES6 function syntax to support IE11
|
|
68
|
+
* _Update npm dependencies to fix vulnerabilities_
|
|
69
|
+
|
|
70
|
+
### 3.4.0
|
|
71
|
+
|
|
72
|
+
* Configure TravisCI on GitHub
|
|
73
|
+
* Update npm dependencies to fix vulnerabilities
|
|
74
|
+
|
|
75
|
+
### 3.3.0
|
|
76
|
+
|
|
77
|
+
* Remove columns by index
|
|
78
|
+
* Filter rows by value
|
|
79
|
+
* _Updated build to Webpack 4.x.x_
|
|
80
|
+
|
|
81
|
+
### 3.2.1
|
|
82
|
+
|
|
83
|
+
* _Update npm dependencies to fix vulnerabilities_
|
|
84
|
+
|
|
85
|
+
### 3.2.0
|
|
86
|
+
|
|
87
|
+
* _Update npm dependencies to fix vulnerabilities_
|
|
88
|
+
|
|
89
|
+
### 3.1.0
|
|
90
|
+
|
|
91
|
+
* Fix old API for base64 and escaping problem.
|
|
92
|
+
|
|
93
|
+
### 3.0.0
|
|
94
|
+
|
|
95
|
+
* XLSX support. This bumps the build size to 640 KB.
|
|
96
|
+
* New API : ExcellentExport.convert(...)
|
|
97
|
+
* Autogenerate download filename.
|
|
98
|
+
* Data input from arrays or HTML Tables.
|
|
99
|
+
* Multiple sheets for XLS or XLSX formats.
|
|
100
|
+
|
|
101
|
+
### 2.1.0
|
|
102
|
+
|
|
103
|
+
* Add Webpack build.
|
|
104
|
+
* Create UMD JavaScript module. Library can be loaded as a module (import, RequireJS, AMD, etc...) or standalone as window.ExcelentExport.
|
|
105
|
+
|
|
106
|
+
### 2.0.3
|
|
107
|
+
|
|
108
|
+
* Fix export as a module.
|
|
109
|
+
* Changed minifier to UglifyJS.
|
|
110
|
+
|
|
111
|
+
### 2.0.2
|
|
112
|
+
|
|
113
|
+
* Fix CSV Chinese characters and other special characters display error in Windows Excel.
|
|
114
|
+
* Fix URL.createObjectURL(...) on Firefox.
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### 2.0.0
|
|
118
|
+
|
|
119
|
+
* Now it can export to big files +2MB.
|
|
120
|
+
* Minimum IE 11.
|
|
121
|
+
* Links open with URL.createObjectURL(...).
|
|
122
|
+
* NPM package available.
|
|
123
|
+
* Using Semantic versioning (2.0.0 instead of 2.0).
|
|
124
|
+
* Module can be loaded standalone or with RequireJS.
|
|
125
|
+
* Change license to MIT.
|
|
126
|
+
|
|
127
|
+
### 1.5
|
|
128
|
+
|
|
129
|
+
* Possibility to select a CSV delimiter.
|
|
130
|
+
* Bower package available.
|
|
131
|
+
* Compose package available.
|
|
132
|
+
|
|
133
|
+
### 1.4
|
|
134
|
+
|
|
135
|
+
* _Add LICENSE.txt with GPL v3_
|
|
136
|
+
* UTF-8 characters fixed.
|
|
137
|
+
|
|
138
|
+
### 1.3
|
|
139
|
+
|
|
140
|
+
* _Added minified version_
|
|
141
|
+
|
|
142
|
+
### 1.1
|
|
143
|
+
|
|
144
|
+
* _Added CSV data export_
|
|
145
|
+
|
|
146
|
+
### 1.0
|
|
147
|
+
|
|
148
|
+
* _Added Excel data export_
|
|
149
|
+
|
|
150
|
+
## Compatibility
|
|
151
|
+
|
|
152
|
+
- Firefox
|
|
153
|
+
- Chrome
|
|
154
|
+
- Internet Explorer 11+
|
|
155
|
+
|
|
156
|
+
# Install
|
|
157
|
+
|
|
158
|
+
## npm
|
|
159
|
+
|
|
160
|
+
npm install excellentexport --save
|
|
161
|
+
|
|
162
|
+
## yarn
|
|
163
|
+
|
|
164
|
+
yarn add excellentexport
|
|
165
|
+
|
|
166
|
+
## bower
|
|
167
|
+
|
|
168
|
+
bower install excellentexport
|
|
169
|
+
|
|
170
|
+
# Load
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
**Include script in your HTML:**
|
|
174
|
+
|
|
175
|
+
<script type="text/javascript" src="dist/excellentexport.js"></script>
|
|
176
|
+
|
|
177
|
+
**Include script in your HTML using CDN:**
|
|
178
|
+
|
|
179
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/excellentexport@3.4.3/dist/excellentexport.min.js"></script>
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
**Require.js**
|
|
183
|
+
|
|
184
|
+
<script src="http://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
|
|
185
|
+
<script>
|
|
186
|
+
require(['dist/excellentexport'], function(ee) {
|
|
187
|
+
window.ExcellentExport = ee;
|
|
188
|
+
});
|
|
189
|
+
</script>
|
|
190
|
+
|
|
191
|
+
**ES6 import**
|
|
192
|
+
|
|
193
|
+
import ExcellentExport from 'excellentexport';
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
# Usage
|
|
197
|
+
|
|
198
|
+
<table id="datatable">
|
|
199
|
+
<tr>
|
|
200
|
+
<td>100</td> <td>200</td> <td>300</td>
|
|
201
|
+
</tr>
|
|
202
|
+
<tr>
|
|
203
|
+
<td>400</td> <td>500</td> <td>600</td>
|
|
204
|
+
</tr>
|
|
205
|
+
</table>
|
|
206
|
+
|
|
207
|
+
<a download="somedata.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
|
|
208
|
+
<a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV</a>
|
|
209
|
+
<!-- new API, xlsx -->
|
|
210
|
+
<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>
|
|
211
|
+
|
|
212
|
+
# API
|
|
213
|
+
|
|
214
|
+
ExcellentExport.convert(options, sheets);
|
|
215
|
+
|
|
216
|
+
Options:
|
|
217
|
+
{
|
|
218
|
+
anchor: String or HTML Element,
|
|
219
|
+
format: 'xlsx' or 'xls' or 'csv',
|
|
220
|
+
filename: String,
|
|
221
|
+
rtl: Use Right-to-left characters, boolean (optional)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
Sheets must be an array of sheet configuration objects. Sheet description:
|
|
225
|
+
[
|
|
226
|
+
{
|
|
227
|
+
name: 'Sheet 1', // Sheet name
|
|
228
|
+
from: {
|
|
229
|
+
table: String/Element, // Table ID or table element
|
|
230
|
+
array: [...] // Array with the data. Array where each element is a row. Every row is an array of the cells.
|
|
231
|
+
},
|
|
232
|
+
removeColumns: [...], // Array of column indexes (from 0)
|
|
233
|
+
filterRowFn: function(row) {return true}, // Function to decide which rows are returned
|
|
234
|
+
fixValue: function(value, row, column) {return fixedValue} // Function to fix values, receiving value, row num, column num
|
|
235
|
+
fixArray: function(array) {return array} // Function to manipulate the whole data array
|
|
236
|
+
rtl: Use Right-to-left characters, boolean (optional)
|
|
237
|
+
...
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
...
|
|
241
|
+
}, ...
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
## fixValue example
|
|
245
|
+
|
|
246
|
+
This is an example for the _fixValue function_ to handle HTML tags inside a table cell.
|
|
247
|
+
It transforms BR to line breaks and then strips all the HTML tags.
|
|
248
|
+
|
|
249
|
+
fixValue: (value, row, col) => {
|
|
250
|
+
let v = value.replace(/<br>/gi, "\n");
|
|
251
|
+
let strippedString = v.replace(/(<([^>]+)>)/gi, "");
|
|
252
|
+
return strippedString;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
# Notes
|
|
257
|
+
|
|
258
|
+
- IE8 or lower do not support *data:* url schema.
|
|
259
|
+
- IE9 does not support *data:* url schema on links.
|
|
260
|
+
- IE10 and above and Edge are supported via the Microsoft-specific `msOpenOrSaveBlob` method.
|
|
261
|
+
|
|
262
|
+
# Test
|
|
263
|
+
|
|
264
|
+
python 2.x:
|
|
265
|
+
python -m SimpleHTTPServer 8000
|
|
266
|
+
|
|
267
|
+
python 3.x:
|
|
268
|
+
python -m http.server 8000
|
|
269
|
+
|
|
270
|
+
# Build
|
|
271
|
+
|
|
272
|
+
**Install dependencies:**
|
|
273
|
+
|
|
274
|
+
npm install
|
|
275
|
+
|
|
276
|
+
**Build development version dist/excellentexport.js**
|
|
277
|
+
|
|
278
|
+
npm run build
|
|
279
|
+
|
|
280
|
+
**Build publish version of dist/excellentexport.js**
|
|
281
|
+
|
|
282
|
+
npm run prod
|
|
283
|
+
|
|
284
|
+
**Publish**
|
|
285
|
+
|
|
286
|
+
npm publish
|