I wanna get way to download(EXPORT) HTML table in another HTML file..
for example I'm now in index.html but i have another file with name of table.html that contains the table that i wanna print..
basically..
When i LOAD index.html start downloading TABLE in table.html
i tried this, but didn't work..
INDEX.HTML
<!DOCTYPE html>
<html>
<script src="http://www.w3schools.com/lib/w3data.js"></script>
<script src="./dist/exportToExcel.js"></script>
<body>
<div w3-include-html="./table.html"></div>
<script>
w3IncludeHTML();
function printEXCEL(type, fn, dl) {
var elt = document.getElementById("tbl_exporttable_to_xls");
var wb = XLSX.utils.table_to_book(elt, { sheet: "sheet1" });
return dl
? XLSX.write(wb, { bookType: type, bookSST: true, type: "base64" })
: XLSX.writeFile(wb, fn || "MySheetName." + (type || "xlsx"));
}
printEXCEL("xlsx");
</script>
</body>
</html>
TABLE.HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="./dist/exportToExcel.js"></script>
</head>
<body>
<table id="tbl_exporttable_to_xls" border="1">
<thead>
<th>Sr</th>
<th>Name</th>
<th>Location</th>
<th>Job Profile</th>
</thead>
<tbody>
<tr>
<td>1</td>
<td><p>کوردی</p></td>
<td>فۆنت</td>
<td>سڵاو</td>
</tr>
<tr>
<td>2</td>
<td><p>Sagar Gada</p></td>
<td>California</td>
<td>Sr FullStack Dev</td>
</tr>
</tbody>
</table>
</body>
</html>