-
-
Notifications
You must be signed in to change notification settings - Fork 304
/
index.format.html
100 lines (95 loc) · 3.19 KB
/
index.format.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Export to excel test</title>
<script src="dist/excellentexport.js"></script>
<style>
table, tr, td {
border: 1px black solid;
}
</style>
<script>
function newApi(format) {
return ExcellentExport.convert({
anchor: 'anchorNewApi-' + format,
filename: 'data',
format: format
}, [{
name: 'Formatted Sheet',
from: {
table: 'datatable'
},
formats: [
{ range: "A2:A10", format: ExcellentExport.formats.INTEGER },
{ range: "B2:B10", format: ExcellentExport.formats.TEXT },
{ range: "C2:C10", format: ExcellentExport.formats.DATE },
{ range: "D2:D10", format: ExcellentExport.formats.DECIMAL },
{ range: "E2:E10", format: ExcellentExport.formats.BOOLEAN },
{ range: "F2:F10", format: ExcellentExport.formats.INTEGER },
{ range: "A5:E5", format: ExcellentExport.formats.TEXT },
{ range: "A6", format: ExcellentExport.formats.DECIMAL },
],
}]);
}
</script>
</head>
<body>
<h1>ExcellentExport.js</h1>
<h3>Test page</h3>
Test table:
<table id="datatable">
<tr>
<th>ID</th>
<th>Name</th>
<th>Birthdate</th>
<th>Salary</th>
<th>Active</th>
<th>Big number</th>
</tr>
<tr>
<td>1</td>
<td>John</td>
<td>1980-12-10</td>
<td>98762000.55</td>
<td>1</td>
<td>987654321987654</td>
</tr>
<tr>
<td>2</td>
<td>Peter</td>
<td>1978-01-23</td>
<td>98762500.43</td>
<td>0</td>
<td>876543219987654</td>
</tr>
<tr>
<td>3</td>
<td>George</td>
<td>1985-11-30</td>
<td>98761800.98</td>
<td>1</td>
<td>765432198987654</td>
</tr>
<tr>
<td>End</td>
<td>End</td>
<td>End</td>
<td>End</td>
<td>End</td>
<td>End</td>
</tr>
<tr>
<td>9876543.21</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<br/>
<a href="#" id="anchorNewApi-xlsx" onclick="return newApi('xlsx');">Export Excel</a>
<a href="#" id="anchorNewApi-csv" onclick="return newApi('csv');">Export CSV</a>
</body>
</html>