docs.sheetjs.com/docz/static/dojo/read.html

35 lines
1.0 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex">
<title>SheetJS + Dojo Read Demo</title>
</head>
<body>
<h1>SheetJS + Dojo Read Demo</h1>
(this HTML page is not minified -- feel free to view source!)<br/><br/>
<a href="https://docs.sheetjs.com">SheetJS CE Documentation</a><br/><br/>
<b>Table output:</b><br/><br/>
<div id="tbl"></div>
<script>
dojoConfig = { packages: [
{ name: "xlsx", location: "https://cdn.sheetjs.com/xlsx-latest/package/dist", main: "xlsx.full.min" }
] };
</script>
<script src="dojo.js" data-dojo-config="isDebug:1, async:1"></script>
<script>
require(["dojo/request/xhr", "xlsx"], function(xhr, _XLSX) {
xhr("https://docs.sheetjs.com/pres.numbers", {
headers: { "X-Requested-With": null },
handleAs: "arraybuffer"
}).then(function(ab) {
/* read ArrayBuffer */
var wb = XLSX.read(ab);
/* display first worksheet data */
var ws = wb.Sheets[wb.SheetNames[0]];
document.getElementById("tbl").innerHTML = XLSX.utils.sheet_to_html(ws);
});
});
</script>
</body>
</html>