From cbaa700decc3017c35cb0e839e4077415ddf5e5e Mon Sep 17 00:00:00 2001 From: SheetJS Date: Sat, 30 Dec 2017 00:40:35 -0500 Subject: [PATCH] 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 --- index.html | 2 +- sheetjs.jsx | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 4a1f85b..4d051dc 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ - + diff --git a/sheetjs.jsx b/sheetjs.jsx index f5c5bc1..c8216b9 100644 --- a/sheetjs.jsx +++ b/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 ( @@ -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}));