Skip to content

Commit

Permalink
version bump 0.18.6
Browse files Browse the repository at this point in the history
  • Loading branch information
SheetJSDev committed Apr 14, 2022
1 parent b1dca24 commit ed18acd
Show file tree
Hide file tree
Showing 45 changed files with 616 additions and 798 deletions.
1 change: 1 addition & 0 deletions .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ utils
commonjs
async
uncheck
vendoring

- demos/altjs/README.md
ChakraCore
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ This log is intended to keep track of backwards-incompatible changes, including
but not limited to API changes and file location changes. Minor behavioral
changes may not be included if they are not expected to break existing code.

## v0.18.6

* Removed all npm dependencies
* Auto-correct bad Google Sheets format `d.m`
* NUMBERS write merge cells, cells up to column "ALL"

## v0.18.5

* Enabled `sideEffects: false` in package.json
Expand Down
55 changes: 35 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ port calculations to web apps; automate common spreadsheet tasks, and much more!
**Standalone Browser Scripts**

The complete browser standalone build is saved to `dist/xlsx.full.min.js` and
can be directly added to a page with a `script` tag:
can be directly added to a page with a `<script>` tag:

```html
<script lang="javascript" src="dist/xlsx.full.min.js"></script>
Expand All @@ -140,6 +140,9 @@ A specific release can be referenced by version:
<script lang="javascript" src="https://cdn.sheetjs.com/xlsx-0.18.5/package/dist/xlsx.full.min.js"></script>
```

For production use, scripts should be downloaded and added to a public folder
alongside other scripts.

</details>

<details>
Expand All @@ -157,8 +160,8 @@ A slimmer build is generated at `dist/xlsx.mini.min.js`. Compared to full build:
These scripts are also available on the CDN:

```html
<!-- use xlsx.core.min.js from the latest version -->
<script lang="javascript" src="https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.core.min.js"></script>
<!-- use xlsx.mini.min.js from the latest version -->
<script lang="javascript" src="https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.mini.min.js"></script>
```

</details>
Expand All @@ -173,21 +176,21 @@ $ bower install js-xlsx
**ECMAScript Modules**

The ECMAScript Module build is saved to `xlsx.mjs` and can be directly added to
a page with a `script` tag using `type=module`:
a page with a `script` tag using `type="module"`:

```html
<script type="module">
import { read, writeFileXLSX } from "./xlsx.mjs";
import { read, writeFileXLSX } from "https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs";
/* load the codepage support library for extended support with older formats */
import { set_cptable } from "./xlsx.mjs";
import * as cptable from './dist/cpexcel.full.mjs';
import { set_cptable } from "https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs";
import * as cptable from 'https://cdn.sheetjs.com/xlsx-latest/package/dist/cpexcel.full.mjs';
set_cptable(cptable);
</script>
```

The [npm package](https://www.npmjs.org/package/xlsx) also exposes the module
with the `module` parameter, supported in Angular and other projects:
The NodeJS package also exposes the module with the `module` parameter, which is
supported in Angular and other projects:

```ts
import { read, writeFileXLSX } from "xlsx";
Expand All @@ -213,20 +216,32 @@ XLSX.set_cptable(cptable);

**NodeJS**

Modules are available on [the public npm registry](https://www.npmjs.org/package/xlsx):
Tarballs are available on <https://cdn.sheetjs.com>.

```bash
$ pnpm install xlsx # using pnpm
$ yarn add xlsx # using yarn
$ npm install xlsx # using npm
```
<https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz> is a link to the latest
version and will refresh on each release.

Each individual version can be referenced using a similar URL pattern.
<https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz> is the URL for `0.18.6`

Tarballs are also available on <https://cdn.sheetjs.com>:
For general stability, "vendoring" modules is the recommended approach:

1) Download the tarball (`xlsx-<version>.tgz`) for the desired version.

2) Create a `vendor` subdirectory at the root of your project and move the
tarball to that folder. Add it to your project repository.

3) Install the tarball using a package manager:

```bash
$ npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz
# note : replace $VERSION with the actual version (e.g. latest or 0.18.6)
$ npm install --save file:vendor/xlsx-$VERSION.tgz # npm
$ pnpm install --save file:vendor/xlsx-$VERSION.tgz # pnpm
$ yarn add file:vendor/xlsx-$VERSION.tgz # yarn
```

The package will be installed and accessible as `xlsx`.

By default, the module supports `require`:

```js
Expand All @@ -253,9 +268,9 @@ XLSX.set_cptable(cpexcel);

**Photoshop and InDesign**

`dist/xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign
that is included in the `npm` package. It can be directly referenced with a
`#include` directive:
`dist/xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign.
<https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.extendscript.js> is the
latest build. It can be directly referenced with a `#include` directive:

```extendscript
#include "xlsx.extendscript.js"
Expand Down
2 changes: 1 addition & 1 deletion bits/01_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
XLSX.version = '0.18.5';
XLSX.version = '0.18.6';
4 changes: 2 additions & 2 deletions bits/29_xlsenum.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var VT_UI4 = 0x0013;
//var VT_UI8 = 0x0015;
//var VT_INT = 0x0016;
//var VT_UINT = 0x0017;
var VT_LPSTR = 0x001E;
//var VT_LPSTR = 0x001E;
//var VT_LPWSTR = 0x001F;
var VT_FILETIME = 0x0040;
var VT_BLOB = 0x0041;
Expand All @@ -33,7 +33,7 @@ var VT_BLOB = 0x0041;
var VT_CF = 0x0047;
//var VT_CLSID = 0x0048;
//var VT_VERSIONED_STREAM = 0x0049;
var VT_VECTOR = 0x1000;
//var VT_VECTOR = 0x1000;
var VT_VECTOR_VARIANT = 0x100C;
var VT_VECTOR_LPSTR = 0x101E;
//var VT_ARRAY = 0x2000;
Expand Down
58 changes: 29 additions & 29 deletions bits/70_csheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, them
if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']];
return s;
}
function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
var o = [XML_HEADER, writextag('chartsheet', null, {
'xmlns': XMLNS_main[0],
'xmlns:r': XMLNS.r
})];
o[o.length] = writextag("drawing", null, {"r:id": "rId1"});
add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW);
if(o.length>2) { o[o.length] = ('</chartsheet>'); o[1]=o[1].replace("/>",">"); }
return o.join("");
}
//function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
// var o = [XML_HEADER, writextag('chartsheet', null, {
// 'xmlns': XMLNS_main[0],
// 'xmlns:r': XMLNS.r
// })];
// o[o.length] = writextag("drawing", null, {"r:id": "rId1"});
// add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW);
// if(o.length>2) { o[o.length] = ('</chartsheet>'); o[1]=o[1].replace("/>",">"); }
// return o.join("");
//}

/* [MS-XLSB] 2.4.331 BrtCsProp */
function parse_BrtCsProp(data, length/*:number*/) {
Expand Down Expand Up @@ -81,22 +81,22 @@ function parse_cs_bin(data, opts, idx/*:number*/, rels, wb/*::, themes, styles*/
if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']];
return s;
}
function write_cs_bin(/*::idx:number, opts, wb:Workbook, rels*/) {
var ba = buf_array();
write_record(ba, 0x0081 /* BrtBeginSheet */);
/* [BrtCsProp] */
/* CSVIEWS */
/* [[BrtCsProtectionIso] BrtCsProtection] */
/* [USERCSVIEWS] */
/* [BrtMargins] */
/* [BrtCsPageSetup] */
/* [HEADERFOOTER] */
/* BrtDrawing */
/* [BrtLegacyDrawing] */
/* [BrtLegacyDrawingHF] */
/* [BrtBkHim] */
/* [WEBPUBITEMS] */
/* FRTCHARTSHEET */
write_record(ba, 0x0082 /* BrtEndSheet */);
return ba.end();
}
//function write_cs_bin(/*::idx:number, opts, wb:Workbook, rels*/) {
// var ba = buf_array();
// write_record(ba, 0x0081 /* BrtBeginSheet */);
// /* [BrtCsProp] */
// /* CSVIEWS */
// /* [[BrtCsProtectionIso] BrtCsProtection] */
// /* [USERCSVIEWS] */
// /* [BrtMargins] */
// /* [BrtCsPageSetup] */
// /* [HEADERFOOTER] */
// /* BrtDrawing */
// /* [BrtLegacyDrawing] */
// /* [BrtLegacyDrawingHF] */
// /* [BrtBkHim] */
// /* [WEBPUBITEMS] */
// /* FRTCHARTSHEET */
// write_record(ba, 0x0082 /* BrtEndSheet */);
// return ba.end();
//}
38 changes: 0 additions & 38 deletions bits/74_xmlbin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ function parse_sty(data, name/*:string*/, themes, opts) {
return parse_sty_xml((data/*:any*/), themes, opts);
}

function parse_theme(data/*:string*/, name/*:string*/, opts) {
return parse_theme_xml(data, opts);
}

function parse_sst(data, name/*:string*/, opts)/*:SST*/ {
if(name.slice(-4)===".bin") return parse_sst_bin((data/*:any*/), opts);
return parse_sst_xml((data/*:any*/), opts);
Expand All @@ -56,37 +52,3 @@ function parse_xlmeta(data, name/*:string*/, opts) {
if(name.slice(-4)===".bin") return parse_xlmeta_bin((data/*:any*/), name, opts);
return parse_xlmeta_xml((data/*:any*/), name, opts);
}

function write_wb(wb, name/*:string*/, opts) {
return (name.slice(-4)===".bin" ? write_wb_bin : write_wb_xml)(wb, opts);
}

function write_ws(data/*:number*/, name/*:string*/, opts, wb/*:Workbook*/, rels) {
return (name.slice(-4)===".bin" ? write_ws_bin : write_ws_xml)(data, opts, wb, rels);
}

// eslint-disable-next-line no-unused-vars
function write_cs(data/*:number*/, name/*:string*/, opts, wb/*:Workbook*/, rels) {
return (name.slice(-4)===".bin" ? write_cs_bin : write_cs_xml)(data, opts, wb, rels);
}

function write_sty(data, name/*:string*/, opts) {
return (name.slice(-4)===".bin" ? write_sty_bin : write_sty_xml)(data, opts);
}

function write_sst(data/*:SST*/, name/*:string*/, opts) {
return (name.slice(-4)===".bin" ? write_sst_bin : write_sst_xml)(data, opts);
}

function write_cmnt(data/*:Array<any>*/, name/*:string*/, opts) {
return (name.slice(-4)===".bin" ? write_comments_bin : write_comments_xml)(data, opts);
}
/*
function write_cc(data, name:string, opts) {
return (name.slice(-4)===".bin" ? write_cc_bin : write_cc_xml)(data, opts);
}
*/

function write_xlmeta(name/*:string*/) {
return (name.slice(-4)===".bin" ? write_xlmeta_bin : write_xlmeta_xml)();
}
19 changes: 8 additions & 11 deletions bits/83_numbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -938,19 +938,17 @@ function write_numbers_iwa(wb, opts) {
cfb.FileIndex.map(function(fi, idx) {
return [fi, cfb.FullPaths[idx]];
}).forEach(function(row) {
var fi = row[0], fp = row[1];
var fi = row[0];
if (!fi.name.match(/\.iwa/))
return;
var x2 = parse_iwa_file(decompress_iwa_file(fi.content));
x2.forEach(function(ia) {
ia.messages.forEach(function(m) {
indices_varint.forEach(function(ivi) {
if (ia.messages.some(function(mess) {
return varint_to_i32(mess.meta[1][0].data) != 11006 && u8contains(mess.data, ivi[1]);
})) {
dependents[ivi[0]].deps.push(ia.id);
}
});
indices_varint.forEach(function(ivi) {
if (ia.messages.some(function(mess) {
return varint_to_i32(mess.meta[1][0].data) != 11006 && u8contains(mess.data, ivi[1]);
})) {
dependents[ivi[0]].deps.push(ia.id);
}
});
});
});
Expand Down Expand Up @@ -1156,10 +1154,9 @@ function write_numbers_iwa(wb, opts) {
delete tile[7];
var rowload = new Uint8Array(tiledata[5][0].data);
tiledata[5] = [];
var cnt = 0;
for (var R2 = 0; R2 <= range.e.r; ++R2) {
var tilerow = parse_shallow(rowload);
cnt += write_tile_row(tilerow, data[R2], SST, USE_WIDE_ROWS);
write_tile_row(tilerow, data[R2], SST, USE_WIDE_ROWS);
tilerow[1][0].data = write_varint49(R2);
tiledata[5].push({ data: write_shallow(tilerow), type: 2 });
}
Expand Down
2 changes: 1 addition & 1 deletion bits/85_parsezip.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
strs = [];
if(dir.sst) try { strs=parse_sst(getzipdata(zip, strip_front_slash(dir.sst)), dir.sst, opts); } catch(e) { if(opts.WTF) throw e; }

if(opts.cellStyles && dir.themes.length) themes = parse_theme(getzipstr(zip, dir.themes[0].replace(/^\//,''), true)||"",dir.themes[0], opts);
if(opts.cellStyles && dir.themes.length) themes = parse_theme_xml(getzipstr(zip, dir.themes[0].replace(/^\//,''), true)||"", opts);

if(dir.style) styles = parse_sty(getzipdata(zip, strip_front_slash(dir.style)), dir.style, themes, opts);
}
Expand Down
16 changes: 6 additions & 10 deletions bits/86_writezip.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* XLSX and XLSB writing are very similar. Originally they were unified in one
export function. This is horrible for tree shaking in the common case (most
applications need to export files in one format) so this function supports
both formats while write_zip_xlsx only handles XLSX */
function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
_shapeid = 1024;
if(wb && !wb.SSF) {
Expand Down Expand Up @@ -65,7 +61,7 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
/* falls through */
default:
f = "xl/worksheets/sheet" + rId + "." + wbext;
zip_add_file(zip, f, write_ws(rId-1, f, opts, wb, wsrels));
zip_add_file(zip, f, write_ws_bin(rId-1, opts, wb, wsrels));
ct.sheets.push(f);
add_rels(opts.wbrels, -1, "worksheets/sheet" + rId + "." + wbext, RELS.WS[0]);
}
Expand All @@ -76,7 +72,7 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
var cf = "";
if(comments && comments.length > 0) {
cf = "xl/comments" + rId + "." + wbext;
zip_add_file(zip, cf, write_cmnt(comments, cf, opts));
zip_add_file(zip, cf, write_comments_bin(comments, opts));
ct.comments.push(cf);
add_rels(wsrels, -1, "../comments" + rId + "." + wbext, RELS.CMNT);
need_vml = true;
Expand All @@ -93,13 +89,13 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {

if(opts.Strings != null && opts.Strings.length > 0) {
f = "xl/sharedStrings." + wbext;
zip_add_file(zip, f, write_sst(opts.Strings, f, opts));
zip_add_file(zip, f, write_sst_bin(opts.Strings, opts));
ct.strs.push(f);
add_rels(opts.wbrels, -1, "sharedStrings." + wbext, RELS.SST);
}

f = "xl/workbook." + wbext;
zip_add_file(zip, f, write_wb(wb, f, opts));
zip_add_file(zip, f, write_wb_bin(wb, opts));
ct.workbooks.push(f);
add_rels(opts.rels, 1, f, RELS.WB);

Expand All @@ -113,7 +109,7 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
/* TODO: something more intelligent with styles */

f = "xl/styles." + wbext;
zip_add_file(zip, f, write_sty(wb, f, opts));
zip_add_file(zip, f, write_sty_bin(wb, opts));
ct.styles.push(f);
add_rels(opts.wbrels, -1, "styles." + wbext, RELS.STY);

Expand All @@ -125,7 +121,7 @@ function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
}

f = "xl/metadata." + wbext;
zip_add_file(zip, f, write_xlmeta(f));
zip_add_file(zip, f, write_xlmeta_bin());
ct.metadata.push(f);
add_rels(opts.wbrels, -1, "metadata." + wbext, RELS.XLMETA);

Expand Down
2 changes: 1 addition & 1 deletion demos/angular2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ enables testing the development version of the library. In order to use this
demo in other applications, add the `xlsx` dependency:

```bash
$ npm install --save xlsx
$ npm install --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz
```

## SystemJS Configuration
Expand Down
2 changes: 1 addition & 1 deletion demos/angular2/ionic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ ! -e SheetJSIonic ]; then
ionic cordova plugin add cordova-plugin-file </dev/null
npm install --save @ionic-native/core
npm install --save @ionic-native/file
npm install --save xlsx
npm install --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz
cp ../ionic-app.module.ts src/app/app.module.ts
cd -
fi
Expand Down
Loading

0 comments on commit ed18acd

Please sign in to comment.