-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_despachos.html
69 lines (62 loc) · 2.07 KB
/
_despachos.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=Cp1252">
<style type="text/css">
body { font-family: verdana, arial, helvetica, sans-serif;
font-size: smaller; }
h1 { font-size: large; }
tr { font-size: smaller; }
th, td { border-left: 1px solid #000000;
border-bottom: 1px solid #000000; padding: 2px; }
th { color: #000000; background: #e9e9f2; }
table { padding: 0px; margin: 0px;
border-top: 1px solid #000000;
border-right: 1px solid #000000; }
table.info { color: #000000; background: #e9e9f2; }
table.data { color: #000000; background: #ffffff; }
td.label { text-align: right; }
td.value { font-weight: bold; }
tr.even { color: #000000; background: #ffffff; }
tr.odd { color: #000000; background: #eeeeee; }
</style>
</head>
<body>
<a href="#" class="" onclick="tableToCSV('report.csv')">Exportar a CSV</a>
<br>
<p>[ Generated by: <a href="http://www.dbvis.com">DbVisualizer Free 10.0</a> ]</p>
<script>
function downloadCSV(csv, filename) {
var csvFile;
var downloadLink;
// CSV file
csvFile = new Blob([csv], {type: "text/csv"});
// Download link
downloadLink = document.createElement("a");
// File name
downloadLink.download = filename;
// Create a link to the file
downloadLink.href = window.URL.createObjectURL(csvFile);
// Hide download link
downloadLink.style.display = "none";
// Add the link to DOM
document.body.appendChild(downloadLink);
// Click download link
downloadLink.click();
}
function tableToCSV(filename) {
var csv = [];
var rows = document.querySelectorAll("table tr");
for (var i = 0; i < rows.length; i++) {
var row = [], cols = rows[i].querySelectorAll("td, th");
for (var j = 0; j < cols.length; j++)
row.push(cols[j].innerText);
csv.push(row.join(","));
}
// Download CSV file
downloadCSV(csv.join("\n"), filename);
}
</script>
</body>
</html>