@rosperitus/excelerate-reader 0.13.0 → 0.14.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.
package/excelerate.d.ts CHANGED
@@ -32,6 +32,33 @@ export interface SheetViewInfo {
32
32
  rightToLeft: boolean;
33
33
  topLeftCell: string | null;
34
34
  }
35
+ /** One of the user's own document properties. */
36
+ export interface CustomProperty {
37
+ name: string;
38
+ type: "text" | "integer" | "number" | "boolean" | "date";
39
+ value: string | number | boolean;
40
+ }
41
+ /** Title, author, dates and the user's fields, as `documentProperties` returns them. Dates are ISO 8601. */
42
+ export interface DocumentProperties {
43
+ title: string | null;
44
+ subject: string | null;
45
+ creator: string | null;
46
+ keywords: string | null;
47
+ description: string | null;
48
+ lastModifiedBy: string | null;
49
+ category: string | null;
50
+ contentStatus: string | null;
51
+ language: string | null;
52
+ identifier: string | null;
53
+ revision: string | null;
54
+ version: string | null;
55
+ created: string | null;
56
+ modified: string | null;
57
+ lastPrinted: string | null;
58
+ company: string | null;
59
+ manager: string | null;
60
+ custom: CustomProperty[];
61
+ }
35
62
  /** A name that stands for a formula, as `definedNames` returns it. */
36
63
  export interface WorkbookName {
37
64
  name: string;
@@ -57,7 +84,7 @@ export interface SheetConditionalFormat {
57
84
  /** The autofilter over a range, as `autoFilter` returns it. */
58
85
  export interface SheetAutoFilter {
59
86
  range: string;
60
- columns: { colId: number; kind: "values" | "custom" | "dynamic" | "top10" | "none" }[];
87
+ columns: { colId: number; kind: "values" | "custom" | "dynamic" | "top10" | "color" | "icon" | "none" }[];
61
88
  }
62
89
  /** A pivot report on the sheet, as `pivotTables` returns it. */
63
90
  export interface SheetPivotTable {
@@ -126,6 +153,22 @@ export interface SheetShape {
126
153
  * a theme colour carries its tint as `theme:4@-0.25`.
127
154
  */
128
155
  export type StyleColor = string | null;
156
+ /**
157
+ * What a run of formatted text changes about the cell's font; a field left
158
+ * out is the cell's own. `size` in points.
159
+ */
160
+ export interface RunFont {
161
+ name?: string;
162
+ size?: number;
163
+ bold?: boolean;
164
+ italic?: boolean;
165
+ underline?: string;
166
+ strike?: boolean;
167
+ color?: StyleColor;
168
+ script?: "superscript" | "subscript" | "baseline";
169
+ }
170
+ /** One run of formatted text, as `getRichText` returns it. */
171
+ export interface TextRun { text: string; font?: RunFont | null }
129
172
  /** One side of a cell's border. */
130
173
  export interface BorderSide { style: string; color: StyleColor }
131
174
  /** How a cell is painted, as `cellStyle` returns it. */
@@ -273,6 +316,12 @@ export class Book {
273
316
  * for. `sheet` is set on a name local to one sheet.
274
317
  */
275
318
  definedNames(): WorkbookName[];
319
+ /**
320
+ * What Excel shows under File > Info: every text field is a string or
321
+ * `null`, dates in ISO 8601. `custom` lists the user's own fields with
322
+ * their type: `text`, `integer`, `number`, `boolean` or `date`.
323
+ */
324
+ documentProperties(): DocumentProperties;
276
325
  /**
277
326
  * The other workbooks this one reads, in the order `[1]Sheet1!A1` counts
278
327
  * them. A path is `undefined` where the file does not name one.
@@ -326,6 +375,16 @@ export class Book {
326
375
  * The same by numbers, as `getRangeAt` takes them.
327
376
  */
328
377
  getRangeStylesAt(sheet: number, row: number, column: number, rows: number, columns: number): RangeStyles;
378
+ /**
379
+ * The runs of a cell's formatted text: `{ text, font }` each, `font`
380
+ * naming only what the run changes about the cell's font, or `null` for
381
+ * a run in the cell's own. `null` for a cell without formatted text.
382
+ */
383
+ getRichText(sheet: number, address: string): TextRun[] | null;
384
+ /**
385
+ * The same by 1-based row and column.
386
+ */
387
+ getRichTextAt(sheet: number, row: number, column: number): TextRun[] | null;
329
388
  /**
330
389
  * A whole row in one crossing of the boundary: values, displayed text,
331
390
  * bold and indent, plus whether the row is hidden.
package/excelerate.js CHANGED
@@ -293,6 +293,16 @@ class Book {
293
293
  const ret = wasm.book_definedNames(this.__wbg_ptr);
294
294
  return ret;
295
295
  }
296
+ /**
297
+ * What Excel shows under File > Info: every text field is a string or
298
+ * `null`, dates in ISO 8601. `custom` lists the user's own fields with
299
+ * their type: `text`, `integer`, `number`, `boolean` or `date`.
300
+ * @returns {DocumentProperties}
301
+ */
302
+ documentProperties() {
303
+ const ret = wasm.book_documentProperties(this.__wbg_ptr);
304
+ return ret;
305
+ }
296
306
  /**
297
307
  * The other workbooks this one reads, in the order `[1]Sheet1!A1` counts
298
308
  * them. A path is `undefined` where the file does not name one.
@@ -487,6 +497,37 @@ class Book {
487
497
  }
488
498
  return takeFromExternrefTable0(ret[0]);
489
499
  }
500
+ /**
501
+ * The runs of a cell's formatted text: `{ text, font }` each, `font`
502
+ * naming only what the run changes about the cell's font, or `null` for
503
+ * a run in the cell's own. `null` for a cell without formatted text.
504
+ * @param {number} sheet
505
+ * @param {string} address
506
+ * @returns {TextRun[] | null}
507
+ */
508
+ getRichText(sheet, address) {
509
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
510
+ const len0 = WASM_VECTOR_LEN;
511
+ const ret = wasm.book_getRichText(this.__wbg_ptr, sheet, ptr0, len0);
512
+ if (ret[2]) {
513
+ throw takeFromExternrefTable0(ret[1]);
514
+ }
515
+ return takeFromExternrefTable0(ret[0]);
516
+ }
517
+ /**
518
+ * The same by 1-based row and column.
519
+ * @param {number} sheet
520
+ * @param {number} row
521
+ * @param {number} column
522
+ * @returns {TextRun[] | null}
523
+ */
524
+ getRichTextAt(sheet, row, column) {
525
+ const ret = wasm.book_getRichTextAt(this.__wbg_ptr, sheet, row, column);
526
+ if (ret[2]) {
527
+ throw takeFromExternrefTable0(ret[1]);
528
+ }
529
+ return takeFromExternrefTable0(ret[0]);
530
+ }
490
531
  /**
491
532
  * A whole row in one crossing of the boundary: values, displayed text,
492
533
  * bold and indent, plus whether the row is hidden.
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rosperitus/excelerate-reader",
3
3
  "description": "Read spreadsheets in the browser or Node: xlsx, xls, ods, csv, html, SYLK, Gnumeric and SpreadsheetML, with cell styles. Reading only.",
4
- "version": "0.13.0",
4
+ "version": "0.14.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",