@bilig/headless 0.11.15 → 0.11.16
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.
- package/README.md +24 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -332,6 +332,30 @@ npm run persistence
|
|
|
332
332
|
- Mutation methods return WorkPaper change arrays. Empty arrays are valid when
|
|
333
333
|
evaluation is suspended or a batch defers change publication.
|
|
334
334
|
|
|
335
|
+
## WorkPaper Read/Write Cheat Sheet
|
|
336
|
+
|
|
337
|
+
The common service and agent calls use the same zero-based address object:
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
const sheet = workbook.getSheetId('Sheet1')
|
|
341
|
+
if (sheet === undefined) throw new Error('Sheet1 was not created')
|
|
342
|
+
const at = (row: number, col: number) => ({ sheet, row, col })
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
| Operation | Public API | Tiny snippet |
|
|
346
|
+
| ----------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
347
|
+
| Create a workbook | `WorkPaper.buildFromSheets()` | `const workbook = WorkPaper.buildFromSheets({ Sheet1: [[1, '=A1*2']] })` |
|
|
348
|
+
| Set a value | `workbook.setCellContents()` | `workbook.setCellContents(at(0, 0), 42)` |
|
|
349
|
+
| Set a formula | `workbook.setCellContents()` | `workbook.setCellContents(at(0, 1), '=A1*2')` |
|
|
350
|
+
| Read a calculated value | `workbook.getCellValue()` | `const value = workbook.getCellValue(at(0, 1))` |
|
|
351
|
+
| Read formula text | `workbook.getCellFormula()` | `const formula = workbook.getCellFormula(at(0, 1))` |
|
|
352
|
+
| Export/persist state | `exportWorkPaperDocument()` and `serializeWorkPaperDocument()` | `const json = serializeWorkPaperDocument(exportWorkPaperDocument(workbook, { includeConfig: true }))` |
|
|
353
|
+
| Restore persisted state | `parseWorkPaperDocument()` and `createWorkPaperFromDocument()` | `const restored = createWorkPaperFromDocument(parseWorkPaperDocument(json))` |
|
|
354
|
+
|
|
355
|
+
Use `getCellDisplayValue()` for user-facing text, `getCellSerialized()` for the
|
|
356
|
+
stored input shape, and range helpers such as `getRangeValues()` when an API
|
|
357
|
+
response needs more than one cell.
|
|
358
|
+
|
|
335
359
|
## Common API Recipes
|
|
336
360
|
|
|
337
361
|
Create an empty workbook:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bilig/headless",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.16",
|
|
4
4
|
"description": "Headless spreadsheet engine for Node.js formulas, workbook JSON persistence, and service-side spreadsheet automation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@bilig/core": "0.11.
|
|
70
|
-
"@bilig/formula": "0.11.
|
|
71
|
-
"@bilig/protocol": "0.11.
|
|
69
|
+
"@bilig/core": "0.11.16",
|
|
70
|
+
"@bilig/formula": "0.11.16",
|
|
71
|
+
"@bilig/protocol": "0.11.16"
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": ">=24.0.0"
|