@simplysm/excel 13.0.72 → 13.0.75

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 +55 -30
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,36 +1,61 @@
1
1
  # @simplysm/excel
2
2
 
3
- Excel file processing library
3
+ Excel file processing library for reading, writing, and manipulating `.xlsx` files.
4
4
 
5
5
  ## Installation
6
6
 
7
+ ```bash
7
8
  pnpm add @simplysm/excel
8
-
9
- ## Source Index
10
-
11
- ### Types and utilities
12
-
13
- | Source | Exports | Description | Test |
14
- |--------|---------|-------------|------|
15
- | `src/types.ts` | `ExcelXmlContentTypeData`, `ExcelXmlRelationshipData`, `ExcelRelationshipData`, `ExcelXmlWorkbookData`, `ExcelXmlWorksheetData`, `ExcelRowData`, `ExcelCellData`, `ExcelXmlDrawingData`, `ExcelXmlSharedStringData`, `ExcelXmlSharedStringDataSi`, `ExcelXmlSharedStringDataText`, `ExcelXmlStyleData`, `ExcelXmlStyleDataXf`, `ExcelXmlStyleDataFill`, `ExcelXmlStyleDataBorder`, `ExcelValueType`, `ExcelNumberFormat`, `ExcelCellType`, `ExcelAddressPoint`, `ExcelAddressRangePoint`, `ExcelXml`, `ExcelBorderPosition`, `ExcelHorizontalAlign`, `ExcelVerticalAlign`, `ExcelStyleOptions` | All shared XML data types, value types, address types, and style option interfaces | - |
16
- | `src/utils/excel-utils.ts` | `ExcelUtils` | Utility functions for address conversion, date/number format mapping | `excel-utils.spec.ts` |
17
-
18
- ### Core classes
19
-
20
- | Source | Exports | Description | Test |
21
- |--------|---------|-------------|------|
22
- | `src/excel-cell.ts` | `ExcelCell` | Single cell with value, formula, style, and merge operations | `excel-cell.spec.ts` |
23
- | `src/excel-row.ts` | `ExcelRow` | Row container providing cell access by column index | `excel-row.spec.ts` |
24
- | `src/excel-col.ts` | `ExcelCol` | Column container providing cell access and column width setting | `excel-col.spec.ts` |
25
- | `src/excel-worksheet.ts` | `ExcelWorksheet` | Worksheet with cell/row/col access, copy, data table, and image support | `excel-worksheet.spec.ts` |
26
- | `src/excel-workbook.ts` | `ExcelWorkbook` | Workbook with lazy-loading ZIP, worksheet management, and export | `excel-workbook.spec.ts` |
27
-
28
- ### Wrapper classes
29
-
30
- | Source | Exports | Description | Test |
31
- |--------|---------|-------------|------|
32
- | `src/excel-wrapper.ts` | `ExcelWrapper` | Zod schema-based type-safe Excel read/write wrapper | `excel-wrapper.spec.ts` |
33
-
34
- ## License
35
-
36
- Apache-2.0
9
+ ```
10
+
11
+ ## Quick Example
12
+
13
+ ```typescript
14
+ import { ExcelWorkbook } from "@simplysm/excel";
15
+
16
+ // Read an existing file
17
+ const bytes: Uint8Array = /* file bytes */;
18
+ await using wb = new ExcelWorkbook(bytes);
19
+ const ws = await wb.getWorksheet(0);
20
+ const table = await ws.getDataTable(); // [{ Name: "Alice", Age: 30 }, ...]
21
+
22
+ // Create a new file
23
+ await using wb2 = new ExcelWorkbook();
24
+ const ws2 = await wb2.createWorksheet("Sheet1");
25
+ await ws2.setRecords([{ Name: "Alice", Age: 30 }]);
26
+ const output = await wb2.getBytes();
27
+ ```
28
+
29
+ ### Type-safe read/write with Zod (ExcelWrapper)
30
+
31
+ ```typescript
32
+ import { ExcelWrapper } from "@simplysm/excel";
33
+ import { z } from "zod";
34
+
35
+ const schema = z.object({
36
+ name: z.string().describe("Name"),
37
+ age: z.number().describe("Age"),
38
+ });
39
+
40
+ const wrapper = new ExcelWrapper(schema);
41
+
42
+ // Read
43
+ const records = await wrapper.read(fileBytes);
44
+
45
+ // Write
46
+ await using wb = await wrapper.write("Members", records);
47
+ const output = await wb.getBytes();
48
+ ```
49
+
50
+ ## Modules
51
+
52
+ | Module | Description | Details |
53
+ |--------|-------------|---------|
54
+ | `ExcelWorkbook` | Top-level workbook handle; open/create/export `.xlsx` files | [docs/workbook.md](docs/workbook.md) |
55
+ | `ExcelWorksheet` | Single worksheet; cell access, copy, data import/export, images | [docs/workbook.md](docs/workbook.md) |
56
+ | `ExcelRow` | Row handle; access cells in a row | [docs/workbook.md](docs/workbook.md) |
57
+ | `ExcelCol` | Column handle; access cells, set width | [docs/workbook.md](docs/workbook.md) |
58
+ | `ExcelCell` | Single cell; read/write values, formulas, styles, merge | [docs/workbook.md](docs/workbook.md) |
59
+ | `ExcelUtils` | Static helpers for address conversion and date/format conversion | [docs/utils.md](docs/utils.md) |
60
+ | `ExcelWrapper` | Zod schema-based type-safe read/write | [docs/wrapper.md](docs/wrapper.md) |
61
+ | Types | Value, address, style, and XML data type definitions | [docs/types.md](docs/types.md) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/excel",
3
- "version": "13.0.72",
3
+ "version": "13.0.75",
4
4
  "description": "Excel file processing library",
5
5
  "author": "simplysm",
6
6
  "license": "Apache-2.0",
@@ -21,6 +21,6 @@
21
21
  "dependencies": {
22
22
  "mime": "^4.1.0",
23
23
  "zod": "^4.3.6",
24
- "@simplysm/core-common": "13.0.72"
24
+ "@simplysm/core-common": "13.0.75"
25
25
  }
26
26
  }