diff --git a/README.md b/README.md index bea66ce..e886bf9 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,14 @@ version and will refresh on each release. Each individual version can be referenced using a similar URL pattern. is the URL for `0.18.6` +Tarballs can be directly installed using a package manager: + +```bash +$ npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # npm +$ pnpm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # pnpm +$ yarn add https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # yarn +``` + For general stability, "vendoring" modules is the recommended approach: 1) Download the tarball (`xlsx-.tgz`) for the desired version. diff --git a/demos/xspreadsheet/index.html b/demos/xspreadsheet/index.html index 633a0ab..dd80a43 100644 --- a/demos/xspreadsheet/index.html +++ b/demos/xspreadsheet/index.html @@ -36,7 +36,7 @@ a { text-decoration: none } ... or click here to select a file -

+


diff --git a/demos/xspreadsheet/xlsxspread.js b/demos/xspreadsheet/xlsxspread.js index 2aec5b6..ac6e910 100644 --- a/demos/xspreadsheet/xlsxspread.js +++ b/demos/xspreadsheet/xlsxspread.js @@ -74,28 +74,18 @@ function xtos(sdata) { sdata.forEach(function (xws) { var ws = {}; var rowobj = xws.rows; + var minCoord = { r: 0, c: 0 }, maxCoord = { r: 0, c: 0 }; for (var ri = 0; ri < rowobj.len; ++ri) { var row = rowobj[ri]; if (!row) continue; - var minCoord, maxCoord; Object.keys(row.cells).forEach(function (k) { var idx = +k; if (isNaN(idx)) return; var lastRef = XLSX.utils.encode_cell({ r: ri, c: idx }); - if (minCoord == null) { - minCoord = { r: ri, c: idx }; - } else { - if (ri < minCoord.r) minCoord.r = ri; - if (idx < minCoord.c) minCoord.c = idx; - } - if (maxCoord == undefined) { - maxCoord = { r: ri, c: idx }; - } else { - if (ri > maxCoord.r) maxCoord.r = ri; - if (idx > maxCoord.c) maxCoord.c = idx; - } + if (ri > maxCoord.r) maxCoord.r = ri; + if (idx > maxCoord.c) maxCoord.c = idx; var cellText = row.cells[k].text, type = "s"; if (!cellText) { @@ -127,12 +117,11 @@ function xtos(sdata) { }); } }); - - ws["!ref"] = XLSX.utils.encode_range({ - s: { r: minCoord.r, c: minCoord.c }, - e: { r: maxCoord.r, c: maxCoord.c } - }); } + ws["!ref"] = minCoord ? XLSX.utils.encode_range({ + s: minCoord, + e: maxCoord + }) : "A1"; XLSX.utils.book_append_sheet(out, ws, xws.name); }); diff --git a/docbits/10_install.md b/docbits/10_install.md index 3978cb6..2ab2174 100644 --- a/docbits/10_install.md +++ b/docbits/10_install.md @@ -110,6 +110,14 @@ version and will refresh on each release. Each individual version can be referenced using a similar URL pattern. is the URL for `0.18.6` +Tarballs can be directly installed using a package manager: + +```bash +$ npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # npm +$ pnpm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # pnpm +$ yarn add https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # yarn +``` + For general stability, "vendoring" modules is the recommended approach: 1) Download the tarball (`xlsx-.tgz`) for the desired version. diff --git a/misc/docs/README.md b/misc/docs/README.md index ff5a1bc..eb0ed39 100644 --- a/misc/docs/README.md +++ b/misc/docs/README.md @@ -217,6 +217,14 @@ version and will refresh on each release. Each individual version can be referenced using a similar URL pattern. is the URL for `0.18.6` +Tarballs can be directly installed using a package manager: + +```bash +$ npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # npm +$ pnpm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # pnpm +$ yarn add https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # yarn +``` + For general stability, "vendoring" modules is the recommended approach: 1) Download the tarball (`xlsx-.tgz`) for the desired version.