docs.sheetjs.com/docz/static/jquery/index.html

59 lines
1.5 KiB
HTML
Raw Normal View History

2023-03-20 18:30:42 +00:00
<!DOCTYPE html>
<!-- sheetjs (C) 2013-present SheetJS https://sheetjs.com -->
<!-- vim: set ts=2: -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="robots" content="noindex">
<title>SheetJS jQuery Demo</title>
<style>
#drop {
border: 2px dashed #bbb;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
padding: 25px;
text-align: center;
font: 20pt bold, "Vollkorn";
color: #bbb
}
a {
text-decoration: none
}
</style>
</head>
<body>
<pre>
<b><a href="https://sheetjs.com">SheetJS jQuery Demo</a></b>
<br />
<button id="doit">Parse pres.numbers</button><br />
<div id="out"></div>
(view source to see the integration code)
</pre>
<script src="https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js"></script>
<script src="jquery-3.6.4.min.js"></script>
<script src="jquery.binarytransport.js"></script>
<script>
$("#doit").click(function () {
$.ajax({
type: "GET",
2024-04-26 04:16:13 +00:00
url: "https://docs.sheetjs.com/pres.numbers",
2023-03-20 18:30:42 +00:00
processData: false,
dataType: "binary",
responseType: "arraybuffer",
success: function (ab) {
/* at this point, ab is an ArrayBuffer */
var wb = XLSX.read(ab);
var ws = wb.Sheets[wb.SheetNames[0]];
var html = XLSX.utils.sheet_to_html(ws);
$("#out").html(html);
}
});
});
</script>
</body>
</html>