45 lines
1.2 KiB

<!DOCTYPE html>
<!-- (C) 2013-present SheetJS -->
<!-- vim: set ts=2: -->
<title>SheetJS JS-XLSX In-Browser Export Demo</title>
<meta charset="utf-8" />
a { text-decoration: none }
<h3><a href="//">SheetJS</a> JS-XLSX In-Browser Export Demo</h3>
<b>Example Code</b>
/* Generate Workbook */
var wb = XLSX.utils.book_new();
var ws = XLSX.utils.aoa_to_sheet([["a","b"],[1,2,3]]);
XLSX.utils.book_append_sheet(wb, ws, "SheetJS");
/* Trigger Download with `writeFile` */
XLSX.writeFile(wb, "SheetJS.xlsb", {compression:true});
<b>Download Generation Methods:</b>
- IE6-9 require ActiveX and Windows Script support.
The IE_SaveFile function from the included shim uses VBScript.
- IE10-11 use msSaveBlob API.
- When supported, `saveAs` will be used.
- When available, modern browsers use `URL.createObjectURL`.
<b>Multiple Download Caveat</b>
Some browsers warn or block attempts to download multiple files. Chrome content
settings support whitelisting domains for automatic multiple downloads.
<script src="shim.js"></script>
<script src="xlsx.full.min.js"></script>
<script src="write.js"></script>