version bump 0.11.16: refresh
- HTML whitespace (fixes #849 h/t @laurentauthier) - XLML number format write (fixes #904 h/t @james-boswell) - XLAM/XLA write - 'array' write type - XLSX/XLSB/XLS/XLML RTL read/write - XLS merge cells write - demo and typing refresh
This commit is contained in:
parent
2f4e08e52d
commit
cbaa700dec
@ -9,7 +9,7 @@
|
||||
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js"></script>
|
||||
<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
|
||||
<script src="node_modules/xlsx/dist/xlsx.full.min.js"></script>
|
||||
<script src="https://unpkg.com/file-saver/FileSaver.js"></script>
|
||||
<style>body, #app { height: 100%; };</style>
|
||||
</head>
|
||||
|
12
sheetjs.jsx
12
sheetjs.jsx
@ -38,9 +38,9 @@ class SheetJSApp extends React.Component {
|
||||
const wb = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(wb, ws, "SheetJS");
|
||||
/* generate XLSX file */
|
||||
const wbout = XLSX.write(wb, {type:"binary", bookType:"xlsx"});
|
||||
const wbout = XLSX.write(wb, {type:"array", bookType:"xlsx"});
|
||||
/* send to client */
|
||||
saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), "sheetjs.xlsx");
|
||||
saveAs(new Blob([wbout],{type:"application/octet-stream"}), "sheetjs.xlsx");
|
||||
};
|
||||
render() { return (
|
||||
<DragDropFile handleFile={this.handleFile}>
|
||||
@ -136,13 +136,5 @@ const SheetJSFT = [
|
||||
"xlsx", "xlsb", "xlsm", "xls", "xml", "csv", "txt", "ods", "fods", "uos", "sylk", "dif", "dbf", "prn", "qpw", "123", "wb*", "wq*", "html", "htm"
|
||||
].map(function(x) { return "." + x; }).join(",");
|
||||
|
||||
/* see Browser download file example in docs */
|
||||
function s2ab(s/*:string*/)/*:ArrayBuffer*/ {
|
||||
const buf = new ArrayBuffer(s.length);
|
||||
const view = new Uint8Array(buf);
|
||||
for (let i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* generate an array of column objects */
|
||||
const make_cols = refstr => Array(XLSX.utils.decode_range(refstr).e.c + 1).fill(0).map((x,i) => ({name:XLSX.utils.encode_col(i), key:i}));
|
||||
|
Loading…
Reference in New Issue
Block a user