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.
@@ -0,0 +1,3 @@
1
+ /*! cpexcel.js (C) 2013-present SheetJS -- http://sheetjs.com */
2
+
3
+ /*! cputils.js (C) 2013-present SheetJS -- http://sheetjs.com */
@@ -0,0 +1,29 @@
1
+ export declare const b64toBlob: (b64Data: string, contentType: string, sliceSize?: number) => Blob;
2
+ export declare const templates: {
3
+ excel: string;
4
+ };
5
+ /**
6
+ * Convert a string to Base64.
7
+ */
8
+ export declare const base64: (s: string) => string;
9
+ export declare const format: (s: string, context: any) => string;
10
+ /**
11
+ * Get element by ID.
12
+ * @param {*} element
13
+ */
14
+ export declare const getTable: (element: (HTMLTableElement | string)) => HTMLTableElement;
15
+ /**
16
+ * Get element by ID.
17
+ * @param {*} element
18
+ */
19
+ export declare const getAnchor: (element: (HTMLAnchorElement | string)) => HTMLAnchorElement;
20
+ /**
21
+ * Encode a value for CSV.
22
+ * @param {*} value
23
+ */
24
+ export declare const fixCSVField: (value: string, csvDelimiter: string) => string;
25
+ export declare const tableToArray: (table: HTMLTableElement) => any[][];
26
+ export declare const tableToCSV: (table: HTMLTableElement, csvDelimiter?: string, csvNewLine?: string) => string;
27
+ export declare const createDownloadLink: (anchor: HTMLAnchorElement, base64data: string, exporttype: string, filename: string) => boolean;
28
+ export declare const string2ArrayBuffer: (s: string) => ArrayBuffer;
29
+ export declare const removeColumns: (dataArray: any[][], columnIndexes: number[]) => void;
@@ -1,80 +1,80 @@
1
- <html>
2
- <head>
3
- <meta charset="utf-8">
4
- <title>Export to excel test</title>
5
- <script src="excellentexport.js"></script>
6
- <style>
7
- table, tr, td {
8
- border: 1px black solid;
9
- }
10
- </style>
11
- </head>
12
- <body>
13
- <h1>ExcellentExport.js</h1>
14
-
15
- Check on <a href="http://jordiburgos.com">jordiburgos.com</a> and <a href="https://github.com/jmaister/excellentexport">GitHub</a>.
16
-
17
- <h3>Test page</h3>
18
-
19
- <br/>
20
-
21
- <a download="somedata.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
22
- <br/>
23
-
24
- <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV - UTF8</a>
25
- <br/>
26
- <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable', ';');">Export to CSV - Using semicolon ";" separator - UTF8</a>
27
- <br/>
28
-
29
- <table id="datatable">
30
- <tr>
31
- <th>Column 1</th>
32
- <th>Column "cool" 2</th>
33
- <th>Column 3</th>
34
- <th>Column 4</th>
35
- </tr>
36
- <tr>
37
- <td>100,111</td>
38
- <td>200</td>
39
- <td>300</td>
40
- <td>áéíóú</td>
41
- </tr>
42
- <tr>
43
- <td>400</td>
44
- <td>500</td>
45
- <td>Chinese chars: 解决导出csv中文乱码问题</td>
46
- <td>àèìòù</td>
47
- </tr>
48
- <tr>
49
- <td>Text</td>
50
- <td>More text</td>
51
- <td>Text with
52
- new line</td>
53
- <td>ç ñ ÄËÏÖÜ äëïöü</td>
54
- </tr>
55
- </table>
56
-
57
-
58
- <br/>
59
- <br/>
60
- <a download="bigdata.xls" href="#" onclick="return ExcellentExport.excel(this, 'bigtable', 'Big Data Sheet');">Export to Excel very big table</a><br/>
61
- <a download="bigdata.csv" href="#" onclick="return ExcellentExport.csv(this, 'bigtable');">Export to CSV very big table</a>
62
- <table id="bigtable">
63
- <br/>
64
- </table>
65
- <script>
66
- var table = document.getElementById('bigtable');
67
- var n = 5000;
68
- var cols = 50;
69
- var i, j;
70
-
71
- for (i=0; i < n; i=i+1) {
72
- var row = table.insertRow(0);
73
- for (j=0; j < cols; j=j+1) {
74
- var cell = row.insertCell(0);
75
- cell.innerHTML = "Test " + Math.random();
76
- }
77
- }
78
- </script>
79
- </body>
80
- </html>
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <title>Export to excel test</title>
5
+ <script src="excellentexport.js"></script>
6
+ <style>
7
+ table, tr, td {
8
+ border: 1px black solid;
9
+ }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <h1>ExcellentExport.js</h1>
14
+
15
+ Check on <a href="http://jordiburgos.com">jordiburgos.com</a> and <a href="https://github.com/jmaister/excellentexport">GitHub</a>.
16
+
17
+ <h3>Test page</h3>
18
+
19
+ <br/>
20
+
21
+ <a download="somedata.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
22
+ <br/>
23
+
24
+ <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV - UTF8</a>
25
+ <br/>
26
+ <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable', ';');">Export to CSV - Using semicolon ";" separator - UTF8</a>
27
+ <br/>
28
+
29
+ <table id="datatable">
30
+ <tr>
31
+ <th>Column 1</th>
32
+ <th>Column "cool" 2</th>
33
+ <th>Column 3</th>
34
+ <th>Column 4</th>
35
+ </tr>
36
+ <tr>
37
+ <td>100,111</td>
38
+ <td>200</td>
39
+ <td>300</td>
40
+ <td>áéíóú</td>
41
+ </tr>
42
+ <tr>
43
+ <td>400</td>
44
+ <td>500</td>
45
+ <td>Chinese chars: 解决导出csv中文乱码问题</td>
46
+ <td>àèìòù</td>
47
+ </tr>
48
+ <tr>
49
+ <td>Text</td>
50
+ <td>More text</td>
51
+ <td>Text with
52
+ new line</td>
53
+ <td>ç ñ ÄËÏÖÜ äëïöü</td>
54
+ </tr>
55
+ </table>
56
+
57
+
58
+ <br/>
59
+ <br/>
60
+ <a download="bigdata.xls" href="#" onclick="return ExcellentExport.excel(this, 'bigtable', 'Big Data Sheet');">Export to Excel very big table</a><br/>
61
+ <a download="bigdata.csv" href="#" onclick="return ExcellentExport.csv(this, 'bigtable');">Export to CSV very big table</a>
62
+ <table id="bigtable">
63
+ <br/>
64
+ </table>
65
+ <script>
66
+ var table = document.getElementById('bigtable');
67
+ var n = 5000;
68
+ var cols = 50;
69
+ var i, j;
70
+
71
+ for (i=0; i < n; i=i+1) {
72
+ var row = table.insertRow(0);
73
+ for (j=0; j < cols; j=j+1) {
74
+ var cell = row.insertCell(0);
75
+ cell.innerHTML = "Test " + Math.random();
76
+ }
77
+ }
78
+ </script>
79
+ </body>
80
+ </html>
@@ -1,63 +1,63 @@
1
- <html>
2
- <head>
3
- <meta charset="utf-8">
4
- <title>Export to excel test</title>
5
- <script src="dist/excellentexport.js"></script>
6
- <style>
7
- table, tr, td {
8
- border: 1px black solid;
9
- }
10
- </style>
11
- <script>
12
- function newApi(format) {
13
- return ExcellentExport.convert({
14
- anchor: 'anchorNewApi-' + format,
15
- filename: 'data_123.' + format,
16
- format: format
17
- }, [{
18
- name: 'Sheet Name Here 1',
19
- from: {
20
- table: 'datatable'
21
- },
22
- fixValue: (value, row, col) => {
23
- let v = value.replace(/<br>/gi, "\n");
24
- let strippedString = v.replace(/(<([^>]+)>)/gi, "");
25
- return strippedString;
26
- }
27
- }]);
28
- }
29
- </script>
30
- </head>
31
- <body>
32
- <h1>ExcellentExport.js</h1>
33
-
34
- Check on <a href="http://jordiburgos.com">jordiburgos.com</a> and <a href="https://github.com/jmaister/excellentexport">GitHub</a>.
35
-
36
- <h3>Test page</h3>
37
-
38
- Test table:
39
- <table id="datatable">
40
- <tr>
41
- <th>Column 1</th>
42
- <th>Column 2</th>
43
- <th>Column 3</th>
44
- <th>Column 4</th>
45
- </tr>
46
- <tr>
47
- <td>hello<br>world</td>
48
- <td><span>text in span</span></td>
49
- <td>abc</td>
50
- <td>def</td>
51
- </tr>
52
- </table>
53
-
54
- <br/>
55
-
56
- <a href="#" id="anchorNewApi-xlsx" onclick="return newApi('xlsx');">Export to XLSX from array</a>
57
- <br>
58
- <a href="#" id="anchorNewApi-xls" onclick="return newApi('xls');">Export to XLS from array</a>
59
- <br>
60
- <a href="#" id="anchorNewApi-csv" onclick="return newApi('csv');">Export to CSV from array</a>
61
-
62
- </body>
63
- </html>
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <title>Export to excel test</title>
5
+ <script src="dist/excellentexport.js"></script>
6
+ <style>
7
+ table, tr, td {
8
+ border: 1px black solid;
9
+ }
10
+ </style>
11
+ <script>
12
+ function newApi(format) {
13
+ return ExcellentExport.convert({
14
+ anchor: 'anchorNewApi-' + format,
15
+ filename: 'data_123.' + format,
16
+ format: format
17
+ }, [{
18
+ name: 'Sheet Name Here 1',
19
+ from: {
20
+ table: 'datatable'
21
+ },
22
+ fixValue: (value, row, col) => {
23
+ let v = value.replace(/<br>/gi, "\n");
24
+ let strippedString = v.replace(/(<([^>]+)>)/gi, "");
25
+ return strippedString;
26
+ }
27
+ }]);
28
+ }
29
+ </script>
30
+ </head>
31
+ <body>
32
+ <h1>ExcellentExport.js</h1>
33
+
34
+ Check on <a href="http://jordiburgos.com">jordiburgos.com</a> and <a href="https://github.com/jmaister/excellentexport">GitHub</a>.
35
+
36
+ <h3>Test page</h3>
37
+
38
+ Test table:
39
+ <table id="datatable">
40
+ <tr>
41
+ <th>Column 1</th>
42
+ <th>Column 2</th>
43
+ <th>Column 3</th>
44
+ <th>Column 4</th>
45
+ </tr>
46
+ <tr>
47
+ <td>hello<br>world</td>
48
+ <td><span>text in span</span></td>
49
+ <td>abc</td>
50
+ <td>def</td>
51
+ </tr>
52
+ </table>
53
+
54
+ <br/>
55
+
56
+ <a href="#" id="anchorNewApi-xlsx" onclick="return newApi('xlsx');">Export to XLSX from array</a>
57
+ <br>
58
+ <a href="#" id="anchorNewApi-xls" onclick="return newApi('xls');">Export to XLS from array</a>
59
+ <br>
60
+ <a href="#" id="anchorNewApi-csv" onclick="return newApi('csv');">Export to CSV from array</a>
61
+
62
+ </body>
63
+ </html>
package/index.html CHANGED
@@ -1,127 +1,127 @@
1
- <html>
2
- <head>
3
- <meta charset="utf-8">
4
- <title>Export to excel test</title>
5
- <script src="dist/excellentexport.js"></script>
6
- <style>
7
- table, tr, td {
8
- border: 1px black solid;
9
- }
10
- </style>
11
- <script>
12
- function newApi(format) {
13
- return ExcellentExport.convert({
14
- anchor: 'anchorNewApi-' + format,
15
- filename: 'data_123.' + format,
16
- format: format
17
- }, [{
18
- name: 'Sheet Name Here 1',
19
- from: {
20
- table: 'datatable'
21
- }
22
- }]);
23
- }
24
-
25
- function newApiArray(format) {
26
- return ExcellentExport.convert({
27
- anchor: 'anchorNewApi-' + format + '-array',
28
- filename: 'data_123.array',
29
- format: format
30
- }, [{
31
- name: 'Sheet Name Here 1',
32
- from: {
33
- array: [['line 1', 1234 , 'CN 你好'],
34
- ['line 2', 1234.56 , 'JP こんにちは']
35
- ]
36
- }
37
- }]);
38
- }
39
-
40
- function exportSome() {
41
- return ExcellentExport.convert({
42
- anchor: "anchorNewApi-xlsx-some",
43
- filename: "somedata",
44
- format: "xlsx"
45
- }, [{
46
- name: 'Sheet number 1',
47
- from: {
48
- table: 'datatable'
49
- },
50
- filterRowFn: function(row) {
51
- if (row[1] == 200) {
52
- return false;
53
- }
54
- return true;
55
- },
56
- removeColumns: [1],
57
-
58
- }])
59
- }
60
- </script>
61
- </head>
62
- <body>
63
- <h1>ExcellentExport.js</h1>
64
-
65
- Check on <a href="http://jordiburgos.com">jordiburgos.com</a> and <a href="https://github.com/jmaister/excellentexport">GitHub</a>.
66
-
67
- <h3>Test page</h3>
68
-
69
- Test table:
70
- <table id="datatable">
71
- <tr>
72
- <th>Column 1</th>
73
- <th>Column "cool" 2</th>
74
- <th>Column 3</th>
75
- <th>Column 4</th>
76
- </tr>
77
- <tr>
78
- <td>100,111</td>
79
- <td>200</td>
80
- <td>030</td>
81
- <td>áéíóú</td>
82
- </tr>
83
- <tr>
84
- <td>400</td>
85
- <td>500</td>
86
- <td>Chinese chars: 解决导出csv中文乱码问题</td>
87
- <td>àèìòù</td>
88
- </tr>
89
- <tr>
90
- <td>Text</td>
91
- <td>More text</td>
92
- <td>Text with
93
- new line</td>
94
- <td>ç ñ ÄËÏÖÜ äëïöü</td>
95
- </tr>
96
- </table>
97
-
98
- <br/>
99
-
100
- <a download="somedata.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
101
- <br/>
102
-
103
- <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV - UTF8</a>
104
- <br/>
105
- <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable', ';');">Export to CSV - Using semicolon ";" separator - UTF8</a>
106
- <br/>
107
- <h1>NEW API!</h1>
108
- <a download="data_123.xls" href="#" id="anchorNewApi-xls" onclick="return newApi('xls');">Export to Excel: XLS format</a>
109
- <br/>
110
- <a download="data_123.xlsx" href="#" id="anchorNewApi-xlsx" onclick="return newApi('xlsx');">Export to Excel: XLSX format</a>
111
- <br/>
112
- <a download="data_123.csv" href="#" id="anchorNewApi-csv" onclick="return newApi('csv');">Export to CSV</a>
113
- <br>
114
- <a href="#" id="anchorNewApi-xlsx-some" onclick="return exportSome();">Export to Excel: XLSX filtering columns and rows</a>
115
- <br/>
116
- <br/>
117
-
118
- <h1>NEW API from Arrays!</h1>
119
-
120
- <a href="#" id="anchorNewApi-xlsx-array" onclick="return newApiArray('xlsx');">Export to XLSX from array</a>
121
- <br>
122
- <a href="#" id="anchorNewApi-xls-array" onclick="return newApiArray('xls');">Export to XLS from array</a>
123
- <br>
124
- <a href="#" id="anchorNewApi-csv-array" onclick="return newApiArray('csv');">Export to CSV from array</a>
125
-
126
- </body>
127
- </html>
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <title>Export to excel test</title>
5
+ <script src="dist/excellentexport.js"></script>
6
+ <style>
7
+ table, tr, td {
8
+ border: 1px black solid;
9
+ }
10
+ </style>
11
+ <script>
12
+ function newApi(format) {
13
+ return ExcellentExport.convert({
14
+ anchor: 'anchorNewApi-' + format,
15
+ filename: 'data_123.' + format,
16
+ format: format
17
+ }, [{
18
+ name: 'Sheet Name Here 1',
19
+ from: {
20
+ table: 'datatable'
21
+ }
22
+ }]);
23
+ }
24
+
25
+ function newApiArray(format) {
26
+ return ExcellentExport.convert({
27
+ anchor: 'anchorNewApi-' + format + '-array',
28
+ filename: 'data_123.array',
29
+ format: format
30
+ }, [{
31
+ name: 'Sheet Name Here 1',
32
+ from: {
33
+ array: [['line 1', 1234 , 'CN 你好'],
34
+ ['line 2', 1234.56 , 'JP こんにちは']
35
+ ]
36
+ }
37
+ }]);
38
+ }
39
+
40
+ function exportSome() {
41
+ return ExcellentExport.convert({
42
+ anchor: "anchorNewApi-xlsx-some",
43
+ filename: "somedata",
44
+ format: "xlsx"
45
+ }, [{
46
+ name: 'Sheet number 1',
47
+ from: {
48
+ table: 'datatable'
49
+ },
50
+ filterRowFn: function(row) {
51
+ if (row[1] == 200) {
52
+ return false;
53
+ }
54
+ return true;
55
+ },
56
+ removeColumns: [1],
57
+
58
+ }])
59
+ }
60
+ </script>
61
+ </head>
62
+ <body>
63
+ <h1>ExcellentExport.js</h1>
64
+
65
+ Check on <a href="http://jordiburgos.com">jordiburgos.com</a> and <a href="https://github.com/jmaister/excellentexport">GitHub</a>.
66
+
67
+ <h3>Test page</h3>
68
+
69
+ Test table:
70
+ <table id="datatable">
71
+ <tr>
72
+ <th>Column 1</th>
73
+ <th>Column "cool" 2</th>
74
+ <th>Column 3</th>
75
+ <th>Column 4</th>
76
+ </tr>
77
+ <tr>
78
+ <td>100,111</td>
79
+ <td>200</td>
80
+ <td>030</td>
81
+ <td>áéíóú</td>
82
+ </tr>
83
+ <tr>
84
+ <td>400</td>
85
+ <td>500</td>
86
+ <td>Chinese chars: 解决导出csv中文乱码问题</td>
87
+ <td>àèìòù</td>
88
+ </tr>
89
+ <tr>
90
+ <td>Text</td>
91
+ <td>More text</td>
92
+ <td>Text with
93
+ new line</td>
94
+ <td>ç ñ ÄËÏÖÜ äëïöü</td>
95
+ </tr>
96
+ </table>
97
+
98
+ <br/>
99
+
100
+ <a download="somedata.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
101
+ <br/>
102
+
103
+ <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV - UTF8</a>
104
+ <br/>
105
+ <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable', ';');">Export to CSV - Using semicolon ";" separator - UTF8</a>
106
+ <br/>
107
+ <h1>NEW API!</h1>
108
+ <a download="data_123.xls" href="#" id="anchorNewApi-xls" onclick="return newApi('xls');">Export to Excel: XLS format</a>
109
+ <br/>
110
+ <a download="data_123.xlsx" href="#" id="anchorNewApi-xlsx" onclick="return newApi('xlsx');">Export to Excel: XLSX format</a>
111
+ <br/>
112
+ <a download="data_123.csv" href="#" id="anchorNewApi-csv" onclick="return newApi('csv');">Export to CSV</a>
113
+ <br>
114
+ <a href="#" id="anchorNewApi-xlsx-some" onclick="return exportSome();">Export to Excel: XLSX filtering columns and rows</a>
115
+ <br/>
116
+ <br/>
117
+
118
+ <h1>NEW API from Arrays!</h1>
119
+
120
+ <a href="#" id="anchorNewApi-xlsx-array" onclick="return newApiArray('xlsx');">Export to XLSX from array</a>
121
+ <br>
122
+ <a href="#" id="anchorNewApi-xls-array" onclick="return newApiArray('xls');">Export to XLS from array</a>
123
+ <br>
124
+ <a href="#" id="anchorNewApi-csv-array" onclick="return newApiArray('csv');">Export to CSV from array</a>
125
+
126
+ </body>
127
+ </html>
@@ -1,31 +1,31 @@
1
- <html>
2
- <head>
3
- <meta charset="utf-8">
4
- <title>Export to excel test</title>
5
- <script src="dist/excellentexport.js"></script>
6
- <style>
7
- table, tr, td {
8
- border: 1px black solid;
9
- }
10
- </style>
11
- <script>
12
-
13
-
14
- function triggerDownload() {
15
- ExcellentExport.convert({ filename: 'fileTriggeredAutomatically', format: 'xlsx', openAsDownload: true},[{name: 'Sheet 1', from: {array: [[1,2,3],[4,5,6]]}},{name: 'Sheet 2', from: {array: [['this is text'],['this is also text']]}}]);
16
- }
17
-
18
- document.addEventListener("DOMContentLoaded", triggerDownload);
19
-
20
- </script>
21
- </head>
22
- <body>
23
- <h1>ExcellentExport.js</h1>
24
-
25
- Check on <a href="http://jordiburgos.com">jordiburgos.com</a> and <a href="https://github.com/jmaister/excellentexport">GitHub</a>.
26
-
27
- <h3>Test without anchor tab</h3>
28
-
29
-
30
- </body>
31
- </html>
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <title>Export to excel test</title>
5
+ <script src="dist/excellentexport.js"></script>
6
+ <style>
7
+ table, tr, td {
8
+ border: 1px black solid;
9
+ }
10
+ </style>
11
+ <script>
12
+
13
+
14
+ function triggerDownload() {
15
+ ExcellentExport.convert({ filename: 'fileTriggeredAutomatically', format: 'xlsx', openAsDownload: true},[{name: 'Sheet 1', from: {array: [[1,2,3],[4,5,6]]}},{name: 'Sheet 2', from: {array: [['this is text'],['this is also text']]}}]);
16
+ }
17
+
18
+ document.addEventListener("DOMContentLoaded", triggerDownload);
19
+
20
+ </script>
21
+ </head>
22
+ <body>
23
+ <h1>ExcellentExport.js</h1>
24
+
25
+ Check on <a href="http://jordiburgos.com">jordiburgos.com</a> and <a href="https://github.com/jmaister/excellentexport">GitHub</a>.
26
+
27
+ <h3>Test without anchor tab</h3>
28
+
29
+
30
+ </body>
31
+ </html>