openjsxl 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -5
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
  [![types included](https://img.shields.io/npm/types/openjsxl)](https://www.npmjs.com/package/openjsxl)
6
6
  [![license: MIT](https://img.shields.io/npm/l/openjsxl?color=blue)](./LICENSE)
7
7
 
8
- Fast, **zero-dependency**, TypeScript-first Excel (`.xlsx`) reader for JavaScript runtimes —
9
- Node, Deno, Bun, the browser, and edge. This is the package to install; it re-exports the
10
- [`@openjsxl/core`](https://www.npmjs.com/package/@openjsxl/core) engine.
8
+ Fast, **zero-dependency**, TypeScript-first Excel (`.xlsx`) reader **and writer** for JavaScript
9
+ runtimes — Node, Deno, Bun, the browser, and edge. This is the package to install; it re-exports
10
+ the [`@openjsxl/core`](https://www.npmjs.com/package/@openjsxl/core) engine.
11
11
 
12
12
  ```sh
13
13
  npm install openjsxl
@@ -30,8 +30,35 @@ for await (const row of wb.sheet(wb.sheets[0].name).rows()) {
30
30
  ```
31
31
 
32
32
  For very large sheets use `streamSheetRows` (constant memory); a worksheet also exposes
33
- `numberFormat`, `dimension`, `mergedCells`, `hyperlinks`, `comments`, and `visible`, and the
34
- reader throws a typed `XlsxError` (with a discriminating `code`) on malformed input.
33
+ `style(ref)`, `numberFormat`, `dimension`, `mergedCells`, `hyperlinks`, `comments`, `columns`,
34
+ `rowProperties`, `freeze`, and `state`/`visible`, and the reader throws a typed `XlsxError`
35
+ (with a discriminating `code`) on malformed input.
36
+
37
+ **Writing:** describe a workbook as plain data and get back `.xlsx` bytes — cell types are
38
+ inferred from the JS values. Cells can carry styles (`{ value, style }` — the same shape
39
+ `style(ref)` returns), and sheets take column widths, row heights, frozen panes, merged ranges,
40
+ hyperlinks, and a visibility state:
41
+
42
+ ```ts
43
+ import { writeXlsx } from 'openjsxl'
44
+
45
+ const bytes = await writeXlsx({
46
+ sheets: [
47
+ {
48
+ name: 'Report',
49
+ rows: [
50
+ [{ value: 'Item', style: { font: { bold: true } } }, 'Added'],
51
+ ['Apples', new Date('2024-01-15')],
52
+ ],
53
+ freeze: { rows: 1 },
54
+ hyperlinks: [{ ref: 'A2', target: 'https://example.com/apples' }],
55
+ },
56
+ ],
57
+ })
58
+ ```
59
+
60
+ `workbookToInput` turns an open `Workbook` back into writer input for read → modify → write —
61
+ values, types, styles, geometry, merges, hyperlinks, and sheet visibility all round-trip.
35
62
 
36
63
  See the [project README](https://github.com/joaquimserafim/openjsxl#readme) for the full guide,
37
64
  design notes, and roadmap.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openjsxl",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "Fast, zero-dependency Excel (.xlsx) reader and writer for Node, Deno, Bun, and the browser.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  ],
31
31
  "sideEffects": false,
32
32
  "dependencies": {
33
- "@openjsxl/core": "0.2.1"
33
+ "@openjsxl/core": "0.4.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@openjsxl/fixtures": "0.0.0"