@libraz/formulon 0.13.0 → 0.15.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/README.md +58 -165
- package/dist/common.js +3 -2
- package/dist/formulon.d.ts +370 -40
- package/dist/formulon.wasm +0 -0
- package/dist/formulon_core.js +1 -1
- package/dist/formulon_threads.wasm +0 -0
- package/dist/formulon_threads_core.js +1 -1
- package/package.json +9 -3
package/dist/formulon.d.ts
CHANGED
|
@@ -520,7 +520,58 @@ export enum CalcMode {
|
|
|
520
520
|
AutoNoTable = 2,
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
|
|
523
|
+
/**
|
|
524
|
+
* Which fold of text comparison `compareText` and `collationClasses` apply.
|
|
525
|
+
* Mirrors `fm_collation_strength_t`.
|
|
526
|
+
*
|
|
527
|
+
* - `Compare` — the fold of `=`, criteria, SEARCH and approximate lookup.
|
|
528
|
+
* - `Dynamic` — the fold of SORT, UNIQUE, XLOOKUP, GROUPBY and pivots.
|
|
529
|
+
* - `ClassicExact` — the fold of MATCH 0 and VLOOKUP FALSE.
|
|
530
|
+
*/
|
|
531
|
+
export enum CollationStrength {
|
|
532
|
+
Compare = 0,
|
|
533
|
+
Dynamic = 1,
|
|
534
|
+
ClassicExact = 2,
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Full formula-behaviour profile id: `mac` or `win` combined with one of
|
|
539
|
+
* `ja_JP`, `en_US`, `de_DE`, `fr_FR`, `zh_CN`, `ko_KR`, `th_TH`, `es_ES`,
|
|
540
|
+
* `es_MX`, `pt_BR`, `ru_RU`, `zh_TW`, `it_IT`, `nl_NL`
|
|
541
|
+
* (for example `win-365-en_US`). New workbooks default to `win-365-en_US`.
|
|
542
|
+
* The `mac-*` ids and `win-365-ja_JP` follow Excel measurements; every other
|
|
543
|
+
* `win-*` id is estimated from the Mac measurements plus the Windows host
|
|
544
|
+
* rules.
|
|
545
|
+
*/
|
|
546
|
+
export type ExcelProfileId =
|
|
547
|
+
| 'mac-365-ja_JP'
|
|
548
|
+
| 'win-365-ja_JP'
|
|
549
|
+
| 'mac-365-en_US'
|
|
550
|
+
| 'win-365-en_US'
|
|
551
|
+
| 'mac-365-de_DE'
|
|
552
|
+
| 'win-365-de_DE'
|
|
553
|
+
| 'mac-365-fr_FR'
|
|
554
|
+
| 'win-365-fr_FR'
|
|
555
|
+
| 'mac-365-zh_CN'
|
|
556
|
+
| 'win-365-zh_CN'
|
|
557
|
+
| 'mac-365-ko_KR'
|
|
558
|
+
| 'win-365-ko_KR'
|
|
559
|
+
| 'mac-365-th_TH'
|
|
560
|
+
| 'win-365-th_TH'
|
|
561
|
+
| 'mac-365-es_ES'
|
|
562
|
+
| 'win-365-es_ES'
|
|
563
|
+
| 'mac-365-es_MX'
|
|
564
|
+
| 'win-365-es_MX'
|
|
565
|
+
| 'mac-365-pt_BR'
|
|
566
|
+
| 'win-365-pt_BR'
|
|
567
|
+
| 'mac-365-ru_RU'
|
|
568
|
+
| 'win-365-ru_RU'
|
|
569
|
+
| 'mac-365-zh_TW'
|
|
570
|
+
| 'win-365-zh_TW'
|
|
571
|
+
| 'mac-365-it_IT'
|
|
572
|
+
| 'win-365-it_IT'
|
|
573
|
+
| 'mac-365-nl_NL'
|
|
574
|
+
| 'win-365-nl_NL';
|
|
524
575
|
|
|
525
576
|
/**
|
|
526
577
|
* A wall-clock reading in local civil fields, as read back from
|
|
@@ -724,9 +775,14 @@ export interface SheetFormatDefaults {
|
|
|
724
775
|
hasDefaultRowHeight: boolean;
|
|
725
776
|
}
|
|
726
777
|
|
|
727
|
-
/** Return type of `Workbook.getSheetFormatDefaults(sheet)`.
|
|
778
|
+
/** Return type of `Workbook.getSheetFormatDefaults(sheet)`. The effective
|
|
779
|
+
* values are read-only and ignored by `setSheetFormatDefaults`. */
|
|
728
780
|
export interface SheetFormatDefaultsResult extends SheetFormatDefaults {
|
|
729
781
|
status: Status;
|
|
782
|
+
/** Character units the sheet lays columns out with: `defaultColWidth` when set, else 8.43. */
|
|
783
|
+
effectiveDefaultColWidth: number;
|
|
784
|
+
/** Points the sheet lays rows out with: `defaultRowHeight` when set, else 102/7 (about 14.57). */
|
|
785
|
+
effectiveDefaultRowHeight: number;
|
|
730
786
|
}
|
|
731
787
|
|
|
732
788
|
/** Return type of `Workbook.getFormula` / `getFormulaR1C1`. `formula` is `null` when the cell holds no formula. */
|
|
@@ -1023,7 +1079,70 @@ export interface CellNode {
|
|
|
1023
1079
|
readonly col: number;
|
|
1024
1080
|
}
|
|
1025
1081
|
|
|
1026
|
-
/**
|
|
1082
|
+
/** One error value's spelling under a profile: the canonical (en-invariant)
|
|
1083
|
+
* text and the profile's Excel spelling. `measured` is `false` when the
|
|
1084
|
+
* localized spelling is assumed rather than captured from Excel. */
|
|
1085
|
+
export interface LocaleErrorName {
|
|
1086
|
+
readonly canonical: string;
|
|
1087
|
+
readonly localized: string;
|
|
1088
|
+
readonly measured: boolean;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/** Order in which a locale writes day, month and year. */
|
|
1092
|
+
export type LocaleDateOrder = 'mdy' | 'ymd' | 'dmy';
|
|
1093
|
+
|
|
1094
|
+
/** Scalar locale facts of one {@link ExcelProfileId}. `measured` is `true`
|
|
1095
|
+
* for the profiles captured from Excel (every `mac-*` id and
|
|
1096
|
+
* `win-365-ja_JP`) and `false` for the estimated `win-*` ids. Every
|
|
1097
|
+
* scalar field is captured in each Mac locale, so `measured` covers them
|
|
1098
|
+
* all; only `errorNames` carries per-entry flags.
|
|
1099
|
+
* `errorNames` is indexed by error-code ordinal. */
|
|
1100
|
+
export interface LocaleFacts {
|
|
1101
|
+
readonly decimalSeparator: string;
|
|
1102
|
+
readonly groupSeparator: string;
|
|
1103
|
+
readonly listSeparator: string;
|
|
1104
|
+
readonly arrayColumnSeparator: string;
|
|
1105
|
+
readonly arrayRowSeparator: string;
|
|
1106
|
+
readonly trueName: string;
|
|
1107
|
+
readonly falseName: string;
|
|
1108
|
+
readonly dateOrder: LocaleDateOrder;
|
|
1109
|
+
readonly currencySymbol: string;
|
|
1110
|
+
/** `true` when the currency symbol follows the number. */
|
|
1111
|
+
readonly currencySuffix: boolean;
|
|
1112
|
+
/** `true` when one space separates the symbol and the number. */
|
|
1113
|
+
readonly currencySpace: boolean;
|
|
1114
|
+
readonly currencyDefaultDecimals: number;
|
|
1115
|
+
readonly measured: boolean;
|
|
1116
|
+
/** `true` when the text collation of this profile was captured from Excel
|
|
1117
|
+
* (every `mac-*` id); `false` for the estimated `win-*` ids, including
|
|
1118
|
+
* `win-365-ja_JP`, whose `measured` is `true` for the other facts. */
|
|
1119
|
+
readonly collationMeasured: boolean;
|
|
1120
|
+
readonly errorNames: readonly LocaleErrorName[];
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/** Result of `Workbook.compareText`. */
|
|
1124
|
+
export interface CompareTextResult {
|
|
1125
|
+
status: Status;
|
|
1126
|
+
/** -1, 0 or 1; 0 when `status` is not ok. */
|
|
1127
|
+
order: number;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
/** Result of `Workbook.collationClasses`. */
|
|
1131
|
+
export interface CollationClassesResult {
|
|
1132
|
+
status: Status;
|
|
1133
|
+
/** One class id per input value; empty when `status` is not ok. */
|
|
1134
|
+
classIds: Uint32Array;
|
|
1135
|
+
classCount: number;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
/** Return type of `Workbook.localeFacts(profileId)`. `facts` is `null` on
|
|
1139
|
+
* failure (an unknown profile id). */
|
|
1140
|
+
export interface LocaleFactsResult {
|
|
1141
|
+
status: Status;
|
|
1142
|
+
facts: LocaleFacts | null;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
/** Result envelope for `functionMetadata(name)`.
|
|
1027
1146
|
*
|
|
1028
1147
|
* `ok` is `false` when no function matches `name`; the remaining
|
|
1029
1148
|
* fields are absent. When `ok` is `true`, `name` / `minArity` /
|
|
@@ -1090,8 +1209,8 @@ export interface MergedFunctionMetadataResult extends FunctionMetadataResult {
|
|
|
1090
1209
|
*
|
|
1091
1210
|
* When `entry` is `undefined`, `base` is returned verbatim (signature /
|
|
1092
1211
|
* description stay `undefined`). `locale` is a BCP-47 display tag matching
|
|
1093
|
-
* the keys in `aliases` / `localized`, independent of the
|
|
1094
|
-
* passed to
|
|
1212
|
+
* the keys in `aliases` / `localized`, independent of the profile id
|
|
1213
|
+
* passed to the engine locale calls. See `docs/function-metadata-schema.md`.
|
|
1095
1214
|
*
|
|
1096
1215
|
* A pure host-side helper: it touches no WASM state and is exported from
|
|
1097
1216
|
* this package's hand-written entry point rather than the generated module
|
|
@@ -1346,7 +1465,7 @@ export interface CellXfResult {
|
|
|
1346
1465
|
* the writer emits the sibling `*Argb` as `rgb`. */
|
|
1347
1466
|
export interface ColorSpec {
|
|
1348
1467
|
/** 0=none, 1=rgb, 2=theme, 3=indexed, 4=auto. */
|
|
1349
|
-
kind:
|
|
1468
|
+
kind: number;
|
|
1350
1469
|
/** AARRGGBB; meaningful when `kind` is 1. */
|
|
1351
1470
|
rgb: number;
|
|
1352
1471
|
/** Theme index; meaningful when `kind` is 2. */
|
|
@@ -1610,7 +1729,7 @@ export interface ExternalLinkRecord {
|
|
|
1610
1729
|
* `TargetMode="External"` (the common case). */
|
|
1611
1730
|
targetExternal: boolean;
|
|
1612
1731
|
/** One of `ExternalLinkKind.*`. */
|
|
1613
|
-
kind:
|
|
1732
|
+
kind: ExternalLinkKind;
|
|
1614
1733
|
}
|
|
1615
1734
|
|
|
1616
1735
|
/** Argument of `Workbook.setCellStyle`. Mirrors `CellStyleResult` without the status. */
|
|
@@ -1762,7 +1881,7 @@ export enum AnchorEditAs {
|
|
|
1762
1881
|
}
|
|
1763
1882
|
|
|
1764
1883
|
/** How a colour was resolved. Mirrors `fm_color_resolution_t`. `Exact` is a literal or workbook-supplied
|
|
1765
|
-
* colour; `DefaultTheme` / `ThemeUnparseable` mean the
|
|
1884
|
+
* colour; `DefaultTheme` / `ThemeUnparseable` mean the current Excel Office (Aptos) theme was used because
|
|
1766
1885
|
* the theme part is absent / unparseable; `IndexOutOfRange` is black; `AutoContext` is an automatic colour
|
|
1767
1886
|
* (black for font and border, white for fills). */
|
|
1768
1887
|
export enum ColorResolution {
|
|
@@ -1796,6 +1915,21 @@ export interface ThemeFonts {
|
|
|
1796
1915
|
minorEastAsian: string;
|
|
1797
1916
|
}
|
|
1798
1917
|
|
|
1918
|
+
/**
|
|
1919
|
+
* One `a:font script="..." typeface="..."` entry of the theme's major or minor
|
|
1920
|
+
* font set. `script` is an ISO 15924 code such as `Jpan`.
|
|
1921
|
+
*
|
|
1922
|
+
* To pick the face for text whose font has `scheme` major or minor, choose the
|
|
1923
|
+
* script from the font's `charset`: 128 -> `Jpan`, 129 -> `Hang`, 134 -> `Hans`,
|
|
1924
|
+
* 136 -> `Hant`, 222 -> `Thai`, anything else -> the latin face
|
|
1925
|
+
* (`ThemeFonts.majorLatin` / `minorLatin`; charsets such as 204 have no script
|
|
1926
|
+
* entry). Use the same table when choosing by the script of the characters.
|
|
1927
|
+
*/
|
|
1928
|
+
export interface ThemeScriptFont {
|
|
1929
|
+
script: string;
|
|
1930
|
+
typeface: string;
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1799
1933
|
/** Return type of `Workbook.getTheme()`. */
|
|
1800
1934
|
export interface ThemeResult {
|
|
1801
1935
|
status: Status;
|
|
@@ -1804,6 +1938,11 @@ export interface ThemeResult {
|
|
|
1804
1938
|
/** 0xFFRRGGBB in `clrScheme` order: dk1, lt1, dk2, lt2, accent1..6, hlink, folHlink. */
|
|
1805
1939
|
colors: number[];
|
|
1806
1940
|
fonts: ThemeFonts;
|
|
1941
|
+
/** The major font set's per-script faces in theme-part order (the 47 Office
|
|
1942
|
+
* scripts when the part is absent). Empty when `status` is not ok. */
|
|
1943
|
+
majorScripts: ThemeScriptFont[];
|
|
1944
|
+
/** The minor font set's per-script faces; see `majorScripts`. */
|
|
1945
|
+
minorScripts: ThemeScriptFont[];
|
|
1807
1946
|
}
|
|
1808
1947
|
|
|
1809
1948
|
/** A resolved colour: 0xFFRRGGBB plus how it was obtained. */
|
|
@@ -2124,12 +2263,54 @@ export interface ImageInsertOptions {
|
|
|
2124
2263
|
heightEmu?: number;
|
|
2125
2264
|
}
|
|
2126
2265
|
|
|
2127
|
-
/** Result of `Workbook.insertImage`; `objectId` is zero on failure. */
|
|
2266
|
+
/** Result of `Workbook.insertImage` and `Workbook.restoreImage`; `objectId` is zero on failure. */
|
|
2128
2267
|
export interface InsertImageResult {
|
|
2129
2268
|
status: Status;
|
|
2130
2269
|
objectId: number;
|
|
2131
2270
|
}
|
|
2132
2271
|
|
|
2272
|
+
/** New placement of an existing picture, in the quantities `listDrawingObjects`
|
|
2273
|
+
* reports: `row` / `col` / `rowOffEmu` / `colOffEmu` are the top-left marker of the
|
|
2274
|
+
* anchor box (`fromRow` ...), `widthEmu` / `heightEmu` the picture's own unrotated
|
|
2275
|
+
* size (`cx` / `cy`); a zero size keeps the current one. `anchorKind` is `OneCell`
|
|
2276
|
+
* (default) or `TwoCell`; `editAs` applies to a two-cell anchor only. */
|
|
2277
|
+
export interface ImagePlacement {
|
|
2278
|
+
anchorKind?: AnchorKind;
|
|
2279
|
+
editAs?: AnchorEditAs;
|
|
2280
|
+
row?: number;
|
|
2281
|
+
col?: number;
|
|
2282
|
+
rowOffEmu?: number;
|
|
2283
|
+
colOffEmu?: number;
|
|
2284
|
+
widthEmu?: number;
|
|
2285
|
+
heightEmu?: number;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
/** Result of `Workbook.rangeStyleBases`; `xfIndices` is ascending and empty on failure. */
|
|
2289
|
+
export interface RangeStyleBasesResult {
|
|
2290
|
+
status: Status;
|
|
2291
|
+
xfIndices: number[];
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
/** Result of `Workbook.snapshotRangeStyle`. `bytes` is an opaque, versioned capture to hand
|
|
2295
|
+
* to `restoreRangeStyle`; it is empty on failure. */
|
|
2296
|
+
export interface RangeStyleSnapshotResult {
|
|
2297
|
+
status: Status;
|
|
2298
|
+
bytes: Uint8Array;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
/** Result of `Workbook.snapshotImage`. `bytes` is an opaque, versioned capture to hand
|
|
2302
|
+
* to `restoreImage`; it is empty on failure. */
|
|
2303
|
+
export interface ImageSnapshotResult {
|
|
2304
|
+
status: Status;
|
|
2305
|
+
bytes: Uint8Array;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
/** Options of `Workbook.restoreImage`. With `newId` the capture is added on top as a
|
|
2309
|
+
* copy with a fresh id; otherwise a picture with the same id is replaced. */
|
|
2310
|
+
export interface RestoreImageOptions {
|
|
2311
|
+
newId?: boolean;
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2133
2314
|
/** Result of the five raw print-settings getters. The empty `xml` string
|
|
2134
2315
|
* means the sheet declares no such element. */
|
|
2135
2316
|
export interface SheetPrintXmlResult {
|
|
@@ -2339,13 +2520,19 @@ export interface Workbook {
|
|
|
2339
2520
|
* cell's text. */
|
|
2340
2521
|
setCellPhoneticProperties(sheet: number, row: number, col: number, properties: PhoneticProperties): Status;
|
|
2341
2522
|
setBlank(sheet: number, row: number, col: number): Status;
|
|
2523
|
+
/** Stores a formula. Returns `kParserUnexpectedToken` and changes nothing when the text
|
|
2524
|
+
* does not parse: a syntax error, or a built-in called through a sheet / workbook qualifier. */
|
|
2342
2525
|
setFormula(sheet: number, row: number, col: number, formula: string): Status;
|
|
2343
2526
|
|
|
2344
2527
|
getValue(sheet: number, row: number, col: number): CellResult;
|
|
2345
2528
|
|
|
2346
|
-
/** The stored A1 formula (leading `=` included), or `formula: null` for a cell that holds none.
|
|
2529
|
+
/** The stored A1 formula (leading `=` included), or `formula: null` for a cell that holds none.
|
|
2530
|
+
* The text is returned as entered; a formula loaded from a file shows book names, not `[N]` indexes. */
|
|
2347
2531
|
getFormula(sheet: number, row: number, col: number): FormulaResult;
|
|
2348
|
-
/** The formula in R1C1 notation relative to the cell, without a leading `=`; `formula: null` when the cell holds none.
|
|
2532
|
+
/** The formula in R1C1 notation relative to the cell, without a leading `=`; `formula: null` when the cell holds none.
|
|
2533
|
+
* A formula loaded from a file that does not parse is kept verbatim, evaluates to `#NAME?`, and fails here with
|
|
2534
|
+
* `kParserUnexpectedToken`; `setFormula` never produces that state.
|
|
2535
|
+
* Sheet and external qualifiers are quoted as a whole only when the path, book or sheet name needs it. */
|
|
2349
2536
|
getFormulaR1C1(sheet: number, row: number, col: number): FormulaResult;
|
|
2350
2537
|
/** One page of the populated cells (formula or non-blank value, spill phantoms included) inside
|
|
2351
2538
|
* `range`, row-major. `cursor` is the `nextCursor` of the previous page (omit for the first);
|
|
@@ -2483,8 +2670,8 @@ export interface Workbook {
|
|
|
2483
2670
|
setPinnedNow(year: number, month: number, day: number, hour: number, minute: number, second: number): Status;
|
|
2484
2671
|
clearPinnedNow(): Status;
|
|
2485
2672
|
|
|
2486
|
-
/**
|
|
2487
|
-
*
|
|
2673
|
+
/** Full formula-behaviour profile id. Defaults to `win-365-en_US`.
|
|
2674
|
+
* Pick another locale or host with any {@link ExcelProfileId}.
|
|
2488
2675
|
*/
|
|
2489
2676
|
excelProfileId(): StringResult<ExcelProfileId>;
|
|
2490
2677
|
setExcelProfileId(profileId: ExcelProfileId): Status;
|
|
@@ -2495,13 +2682,15 @@ export interface Workbook {
|
|
|
2495
2682
|
* hyperlinks, tables, print areas, manual breaks and the auto-filter
|
|
2496
2683
|
* range. The ranges and formulas inside the worksheet `<extLst>` (the
|
|
2497
2684
|
* `x14` conditional-formatting block, sparkline groups, `x14`
|
|
2498
|
-
* validations) move with them, as Excel moves them
|
|
2685
|
+
* validations) move with them, as Excel moves them, and so do the cells
|
|
2686
|
+
* named by the other worksheet content kept verbatim for a lossless save:
|
|
2687
|
+
* protected ranges, scenarios, a sheet sort state, cell watches,
|
|
2688
|
+
* ignored-error ranges and web-publish ranges.
|
|
2499
2689
|
*
|
|
2500
|
-
* They do not move an
|
|
2501
|
-
*
|
|
2502
|
-
*
|
|
2503
|
-
*
|
|
2504
|
-
* new one, which Excel does — a sparkline included.
|
|
2690
|
+
* They do not move the anchor of an embedded OLE object or form control,
|
|
2691
|
+
* also kept verbatim: it keeps its pre-edit cell, and nothing reports it.
|
|
2692
|
+
* An insert also does not copy the formatting of the row or column before
|
|
2693
|
+
* it onto the new one, which Excel does — a sparkline included.
|
|
2505
2694
|
*/
|
|
2506
2695
|
|
|
2507
2696
|
/** Inserts `count` rows at `row` on `sheet` and rewrites cross-workbook
|
|
@@ -2521,10 +2710,12 @@ export interface Workbook {
|
|
|
2521
2710
|
definedNameCount(): NumberResult;
|
|
2522
2711
|
definedNameAt(idx: number): DefinedNameEntry;
|
|
2523
2712
|
/** Adds, replaces, or (when `formula` is empty) removes a workbook-
|
|
2524
|
-
* scoped defined name.
|
|
2713
|
+
* scoped defined name. A non-empty `formula` that does not parse is
|
|
2714
|
+
* rejected with `kParserUnexpectedToken`. */
|
|
2525
2715
|
setDefinedName(name: string, formula: string): Status;
|
|
2526
2716
|
/** Adds, replaces, or removes a defined name in workbook scope (-1)
|
|
2527
|
-
* or a sheet-local scope (0-based sheet index).
|
|
2717
|
+
* or a sheet-local scope (0-based sheet index). A non-empty `formula`
|
|
2718
|
+
* that does not parse is rejected with `kParserUnexpectedToken`. */
|
|
2528
2719
|
setDefinedNameScoped(name: string, formula: string, localSheetId: number): Status;
|
|
2529
2720
|
|
|
2530
2721
|
tableCount(): NumberResult;
|
|
@@ -2599,6 +2790,14 @@ export interface Workbook {
|
|
|
2599
2790
|
insertImage(sheet: number, bytes: Uint8Array, opts?: ImageInsertOptions): InsertImageResult;
|
|
2600
2791
|
/** Removes the picture `objectId` and its media once nothing else references it. */
|
|
2601
2792
|
removeImage(sheet: number, objectId: number): Status;
|
|
2793
|
+
/** Moves and resizes the picture `objectId`, keeping its id, crop, rotation and every other element. */
|
|
2794
|
+
setImageAnchor(sheet: number, objectId: number, placement: ImagePlacement): Status;
|
|
2795
|
+
/** Makes the picture `objectId` item `index` of `listDrawingObjects`, whose order is the stacking order (0 is the back). */
|
|
2796
|
+
setImageZOrder(sheet: number, objectId: number, index: number): Status;
|
|
2797
|
+
/** Captures the picture `objectId` with its list position, element and media as opaque bytes for `restoreImage`. */
|
|
2798
|
+
snapshotImage(sheet: number, objectId: number): ImageSnapshotResult;
|
|
2799
|
+
/** Puts a `snapshotImage` capture back and returns the picture's id: in place of a picture with the same id at its recorded position, or as a copy on top with `newId`. */
|
|
2800
|
+
restoreImage(sheet: number, bytes: Uint8Array, opts?: RestoreImageOptions): InsertImageResult;
|
|
2602
2801
|
|
|
2603
2802
|
passthroughCount(): NumberResult;
|
|
2604
2803
|
passthroughAt(idx: number): PassthroughEntry;
|
|
@@ -2927,6 +3126,10 @@ export interface Workbook {
|
|
|
2927
3126
|
setColumnHidden(sheet: number, first: number, last: number, hidden: boolean): Status;
|
|
2928
3127
|
/** Sets / replaces the column outline level on `[first, last]` (clamped to 0..255). */
|
|
2929
3128
|
setColumnOutline(sheet: number, first: number, last: number, level: number): Status;
|
|
3129
|
+
/** Sets / replaces the cell-style XF on `[first, last]`; index 0 is the default XF. A value later entered into an unstyled cell of the span takes this XF, unless its row has a style. */
|
|
3130
|
+
setColumnStyle(sheet: number, first: number, last: number, xfIndex: number): Status;
|
|
3131
|
+
/** Removes the cell-style XF on `[first, last]`, retaining other column attributes. */
|
|
3132
|
+
clearColumnStyle(sheet: number, first: number, last: number): Status;
|
|
2930
3133
|
|
|
2931
3134
|
/** Returns the row-layout overrides on `sheet`. */
|
|
2932
3135
|
getSheetRowOverrides(sheet: number): RowsResult;
|
|
@@ -2936,8 +3139,60 @@ export interface Workbook {
|
|
|
2936
3139
|
setRowHidden(sheet: number, row: number, hidden: boolean): Status;
|
|
2937
3140
|
/** Sets / replaces the row outline level at `row` (clamped to 0..255). */
|
|
2938
3141
|
setRowOutline(sheet: number, row: number, level: number): Status;
|
|
3142
|
+
/** Sets / replaces the cell-style XF of the inclusive row span `first..last`; index 0 is the default XF. A value later entered into an unstyled cell of a covered row takes this XF. Nothing changes on failure. */
|
|
3143
|
+
setRowStyle(sheet: number, first: number, last: number, xfIndex: number): Status;
|
|
3144
|
+
/** Removes the cell-style XF of the inclusive row span `first..last`, retaining other row attributes. */
|
|
3145
|
+
clearRowStyle(sheet: number, first: number, last: number): Status;
|
|
3146
|
+
/**
|
|
3147
|
+
* Lists, ascending, every cell-XF index a cell of the selection may resolve to: 0, the
|
|
3148
|
+
* covered row and column styles, and the XFs of cells that carry their own. The rect
|
|
3149
|
+
* `(firstRow, firstCol)..(lastRow, lastCol)` is a selection: all rows make it a column
|
|
3150
|
+
* selection, all columns a row selection, both the whole sheet.
|
|
3151
|
+
*
|
|
3152
|
+
* First step of an attribute-only change (say the font size) over a selection, the way
|
|
3153
|
+
* Excel applies it to a row, column, range or the whole sheet: read the bases here, build
|
|
3154
|
+
* each one's patched XF with `addFont` / `addCellXf`, then apply the pairs with
|
|
3155
|
+
* `remapRangeStyle`.
|
|
3156
|
+
*/
|
|
3157
|
+
rangeStyleBases(
|
|
3158
|
+
sheet: number,
|
|
3159
|
+
firstRow: number,
|
|
3160
|
+
firstCol: number,
|
|
3161
|
+
lastRow: number,
|
|
3162
|
+
lastCol: number,
|
|
3163
|
+
): RangeStyleBasesResult;
|
|
3164
|
+
/**
|
|
3165
|
+
* Second step of the attribute patch: every cell of the selection ends at `toXfs[i]` where
|
|
3166
|
+
* it resolved to `fromXfs[i]` before; an XF not listed is kept. Covered row and column
|
|
3167
|
+
* styles are rewritten and existing cells remapped; a cell is materialised only where
|
|
3168
|
+
* row-over-column precedence would otherwise resolve differently (for a plain range, every
|
|
3169
|
+
* cell). Values and formulas are untouched. Fails, changing nothing, when the arrays differ
|
|
3170
|
+
* in length, a `fromXfs` entry repeats, a `toXfs` entry is past the cell-XF table, or more
|
|
3171
|
+
* than 1,048,576 cells would be written.
|
|
3172
|
+
*/
|
|
3173
|
+
remapRangeStyle(
|
|
3174
|
+
sheet: number,
|
|
3175
|
+
firstRow: number,
|
|
3176
|
+
firstCol: number,
|
|
3177
|
+
lastRow: number,
|
|
3178
|
+
lastCol: number,
|
|
3179
|
+
fromXfs: number[],
|
|
3180
|
+
toXfs: number[],
|
|
3181
|
+
): Status;
|
|
3182
|
+
/** Captures the style state of a selection (covered column or row styles and every stored cell's XF) as opaque, versioned bytes for `restoreRangeStyle`; use it to undo a `remapRangeStyle`. */
|
|
3183
|
+
snapshotRangeStyle(
|
|
3184
|
+
sheet: number,
|
|
3185
|
+
firstRow: number,
|
|
3186
|
+
firstCol: number,
|
|
3187
|
+
lastRow: number,
|
|
3188
|
+
lastCol: number,
|
|
3189
|
+
): RangeStyleSnapshotResult;
|
|
3190
|
+
/** Puts a `snapshotRangeStyle` capture back exactly. Values, formulas, phonetic runs and comments are not touched; nothing changes on failure. */
|
|
3191
|
+
restoreRangeStyle(sheet: number, bytes: Uint8Array): Status;
|
|
2939
3192
|
/** Removes the height override at `row`, returning it to the sheet default. */
|
|
2940
3193
|
clearRowHeight(sheet: number, row: number): Status;
|
|
3194
|
+
/** Removes the width override on columns `first..last`, returning them to the sheet default width. Hidden state, outline level and column style are kept. */
|
|
3195
|
+
clearColumnWidth(sheet: number, first: number, last: number): Status;
|
|
2941
3196
|
|
|
2942
3197
|
/** Reads the sheet's default column / row metrics. */
|
|
2943
3198
|
getSheetFormatDefaults(sheet: number): SheetFormatDefaultsResult;
|
|
@@ -2962,6 +3217,15 @@ export interface Workbook {
|
|
|
2962
3217
|
getCellXfIndex(sheet: number, row: number, col: number): CellXfIndexResult;
|
|
2963
3218
|
/** Persists `xfIndex` on the cell at `(sheet, row, col)`. */
|
|
2964
3219
|
setCellXfIndex(sheet: number, row: number, col: number, xfIndex: number): Status;
|
|
3220
|
+
/**
|
|
3221
|
+
* Removes the direct style assignment from the cell at `(sheet, row, col)`
|
|
3222
|
+
* so a blank cell inherits its row / column style again. Value, formula and
|
|
3223
|
+
* comments are kept; an absent cell stays absent. A non-blank cell keeps
|
|
3224
|
+
* owning the default xf. Use `getEffectiveStyle().source` to tell an
|
|
3225
|
+
* unassigned cell (`Row` / `Column` / `Default`) from a direct Normal
|
|
3226
|
+
* (`Cell`).
|
|
3227
|
+
*/
|
|
3228
|
+
clearCellXfIndex(sheet: number, row: number, col: number): Status;
|
|
2965
3229
|
/** Applies `xfIndex` across an inclusive rectangle, materialising blank
|
|
2966
3230
|
* cells so an empty ruled box renders. Saves one call per cell. */
|
|
2967
3231
|
setRangeXfIndex(
|
|
@@ -3064,6 +3328,14 @@ export interface Workbook {
|
|
|
3064
3328
|
setThemeColors(colors: number[]): Status;
|
|
3065
3329
|
/** Rewrites the theme's major and minor typefaces. */
|
|
3066
3330
|
setThemeFonts(fonts: ThemeFonts): Status;
|
|
3331
|
+
/** Sets one script's typeface in the major (`major` true) or minor font set;
|
|
3332
|
+
* other scripts are unchanged and an unknown script is appended. `Jpan` also
|
|
3333
|
+
* changes `ThemeFonts.*EastAsian`. A workbook without a theme part first gets
|
|
3334
|
+
* one with the full default set. `script` must be four ASCII letters and
|
|
3335
|
+
* `typeface` non-empty, else the status is not ok. */
|
|
3336
|
+
setThemeScriptFont(major: boolean, script: string, typeface: string): Status;
|
|
3337
|
+
/** Removes the theme part so the workbook reports the default theme (`source` is `Default`). Excel adds a theme part again when it saves the file. */
|
|
3338
|
+
resetTheme(): Status;
|
|
3067
3339
|
/** Resolves a colour specification to ARGB against the theme and the
|
|
3068
3340
|
* indexed palette; `context` decides what an automatic colour means. */
|
|
3069
3341
|
resolveColor(spec: ColorSpec, context: ColorContext): ResolvedColorResult;
|
|
@@ -3075,7 +3347,9 @@ export interface Workbook {
|
|
|
3075
3347
|
/** Returns every external-link record carried by the workbook in
|
|
3076
3348
|
* `<externalReferences>` document order. Empty for fresh workbooks
|
|
3077
3349
|
* and any package whose source archive had no `<externalReferences>`
|
|
3078
|
-
* block.
|
|
3350
|
+
* block. A formula, name, conditional-format rule or data validation that names an unregistered
|
|
3351
|
+
* book (bracket or path spelling) appends a record without renumbering; a book already present,
|
|
3352
|
+
* in any letter case, adds none. */
|
|
3079
3353
|
getExternalLinks(): ListResult<ExternalLinkRecord>;
|
|
3080
3354
|
|
|
3081
3355
|
/** Adds a merge range to `sheet`. */
|
|
@@ -3139,7 +3413,8 @@ export interface Workbook {
|
|
|
3139
3413
|
* cell-range list; the rule itself surfaces its raw OOXML payload
|
|
3140
3414
|
* (the engine does not yet evaluate validation rules). */
|
|
3141
3415
|
getValidations(sheet: number): ListResult<DataValidationEntry>;
|
|
3142
|
-
/** Appends a data-validation rule to `sheet`.
|
|
3416
|
+
/** Appends a data-validation rule to `sheet`. A non-empty `formula1` / `formula2`
|
|
3417
|
+
* that does not parse is rejected with `kParserUnexpectedToken`. */
|
|
3143
3418
|
addValidation(sheet: number, validation: DataValidationInput): Status;
|
|
3144
3419
|
/** Removes the validation rule at `index`. Returns `kInvalidArgument`
|
|
3145
3420
|
* if `index` is out of range. */
|
|
@@ -3156,7 +3431,9 @@ export interface Workbook {
|
|
|
3156
3431
|
* `index` is the new rule's position in the sheet's flattened CF rule
|
|
3157
3432
|
* sequence (the same indexing `getConditionalFormats` and
|
|
3158
3433
|
* `removeConditionalFormatAt` use); it stays valid until a subsequent
|
|
3159
|
-
* add/remove/clear mutation on the same sheet renumbers the sequence.
|
|
3434
|
+
* add/remove/clear mutation on the same sheet renumbers the sequence.
|
|
3435
|
+
* A non-empty `formula1` / `formula2` that does not parse is rejected
|
|
3436
|
+
* with `kParserUnexpectedToken`. */
|
|
3160
3437
|
addConditionalFormat(sheet: number, rule: ConditionalFormatInput): AddStyleResult;
|
|
3161
3438
|
/** Removes the CF rule at `index` (flattened order). When the
|
|
3162
3439
|
* containing block becomes empty it is removed too. */
|
|
@@ -3175,28 +3452,69 @@ export interface Workbook {
|
|
|
3175
3452
|
dependents(sheet: number, row: number, col: number, depth: number): ListResult<CellNode>;
|
|
3176
3453
|
|
|
3177
3454
|
/** Returns metadata for the function `name` (case-insensitive). When
|
|
3178
|
-
* the function is unknown, returns `{ok: false}`.
|
|
3179
|
-
*
|
|
3180
|
-
*
|
|
3181
|
-
|
|
3182
|
-
functionMetadata(name: string, locale: number): FunctionMetadataResult;
|
|
3455
|
+
* the function is unknown, returns `{ok: false}`. The result is
|
|
3456
|
+
* locale-invariant: the description / signature fields are always
|
|
3457
|
+
* `undefined` (see {@link FunctionMetadataResult}). */
|
|
3458
|
+
functionMetadata(name: string): FunctionMetadataResult;
|
|
3183
3459
|
/** Returns every registered function's canonical name in ascending
|
|
3184
3460
|
* sort order. */
|
|
3185
3461
|
functionNames(): ListResult<string>;
|
|
3186
3462
|
|
|
3187
3463
|
/** Returns the localized display name for the canonical function
|
|
3188
|
-
* `canonicalName`
|
|
3189
|
-
*
|
|
3190
|
-
*
|
|
3191
|
-
*
|
|
3192
|
-
*
|
|
3193
|
-
|
|
3464
|
+
* `canonicalName` under `profileId`. `de_DE`, `fr_FR`, `es_ES`, `es_MX`,
|
|
3465
|
+
* `pt_BR`, `ru_RU`, `it_IT` and `nl_NL` profiles return Excel's function
|
|
3466
|
+
* names for that locale; `en_US`, `zh_CN`, `ko_KR` and `th_TH` return the
|
|
3467
|
+
* canonical name unchanged. `ja_JP` renames only `DOLLAR`, `USDOLLAR` and
|
|
3468
|
+
* `DBCS`; `zh_TW` renames only `DBCS`. `value` is the empty string, with
|
|
3469
|
+
* `status.ok === false`,
|
|
3470
|
+
* when `profileId` is unknown or the name does not match a registered
|
|
3471
|
+
* function. */
|
|
3472
|
+
localizeFunctionName(canonicalName: string, profileId: ExcelProfileId): StringResult;
|
|
3194
3473
|
/** Inverse of `localizeFunctionName`: returns the canonical English
|
|
3195
|
-
* name for the localized function `localizedName
|
|
3196
|
-
*
|
|
3197
|
-
*
|
|
3198
|
-
|
|
3199
|
-
|
|
3474
|
+
* name for the localized function `localizedName` under `profileId`.
|
|
3475
|
+
* `value` is the empty string, with `status.ok === false`, when
|
|
3476
|
+
* `profileId` is unknown or no function matches. */
|
|
3477
|
+
canonicalizeFunctionName(localizedName: string, profileId: ExcelProfileId): StringResult;
|
|
3478
|
+
/** Rewrites stored (en-invariant) formula text into `profileId`'s Excel
|
|
3479
|
+
* spelling: function names, list / array separators, decimal points,
|
|
3480
|
+
* booleans and error names. Strings, quoted sheet names, external
|
|
3481
|
+
* qualifiers and structured-reference brackets are kept verbatim. A pure
|
|
3482
|
+
* text rewrite; the grammar is not validated. `status.ok` is `false`
|
|
3483
|
+
* for an unknown `profileId`. */
|
|
3484
|
+
localizeFormula(formula: string, profileId: ExcelProfileId): StringResult;
|
|
3485
|
+
/** Inverse of `localizeFormula`: rewrites `profileId`-spelled formula text
|
|
3486
|
+
* into the en-invariant form. */
|
|
3487
|
+
canonicalizeFormula(formula: string, profileId: ExcelProfileId): StringResult;
|
|
3488
|
+
/** Returns the locale facts (separators, boolean names, date order,
|
|
3489
|
+
* currency, error names) of `profileId`. */
|
|
3490
|
+
localeFacts(profileId: ExcelProfileId): LocaleFactsResult;
|
|
3491
|
+
/** Compares two texts under `profileId` and returns the sign of the
|
|
3492
|
+
* result in `order`. `strength` picks the fold (see
|
|
3493
|
+
* {@link CollationStrength}); it is a text comparison, not Excel's `=`
|
|
3494
|
+
* on two cells. `status.ok` is `false` for an unknown `profileId`. */
|
|
3495
|
+
compareText(a: string, b: string, strength: CollationStrength, profileId: ExcelProfileId): CompareTextResult;
|
|
3496
|
+
/** Classifies `values` into collation-ordered equivalence classes under
|
|
3497
|
+
* `profileId`. `classIds[i]` is the class of `values[i]`: two values share
|
|
3498
|
+
* an id exactly when they have the same kind and compare equal (texts by
|
|
3499
|
+
* the `strength` fold, numbers by value with -0 equal to 0, booleans and
|
|
3500
|
+
* errors by value, blanks always equal), and ids ascend in SORT order
|
|
3501
|
+
* (numbers < texts < booleans < errors < blanks), dense from 0.
|
|
3502
|
+
* Ids are meaningful only within one call; never store or compare them
|
|
3503
|
+
* across calls. Every element must be an object carrying `kind`
|
|
3504
|
+
* (a missing `kind` yields a non-ok `status`, not a blank).
|
|
3505
|
+
*
|
|
3506
|
+
* Typical use:
|
|
3507
|
+
* - Dedupe or checklist order: take the first position of each id and
|
|
3508
|
+
* order by id.
|
|
3509
|
+
* - Sort: stable-sort by id; reverse for descending, keeping blanks last.
|
|
3510
|
+
* - Re-applying a saved selection: keep it as typed `Value`s, classify
|
|
3511
|
+
* `[...saved, ...columnValues]` in one call and select the ids that match.
|
|
3512
|
+
* - Multi-column dedupe: call once per column and compare the per-row id
|
|
3513
|
+
* tuples.
|
|
3514
|
+
* - Feed it kind-preserving values (cell getters, paged range reads);
|
|
3515
|
+
* `evaluateFormulaArray` returns range blanks as 0, losing the
|
|
3516
|
+
* blank/zero distinction. */
|
|
3517
|
+
collationClasses(values: Value[], strength: CollationStrength, profileId: ExcelProfileId): CollationClassesResult;
|
|
3200
3518
|
|
|
3201
3519
|
/** Returns dynamic-array spill info for `(sheet, row, col)`.
|
|
3202
3520
|
* When the cell is part of a spill region (anchor or phantom),
|
|
@@ -3213,6 +3531,18 @@ export interface WorkbookCtor {
|
|
|
3213
3531
|
createDefault(): Workbook;
|
|
3214
3532
|
/** Workbook with no sheets. */
|
|
3215
3533
|
createEmpty(): Workbook;
|
|
3534
|
+
/** Workbook with the new-workbook defaults of an Excel profile id such as
|
|
3535
|
+
* `"mac-365-ja_JP"`: font 0 (name, charset, theme-minor scheme), the
|
|
3536
|
+
* phonetic font (font 1, CJK locales), the Normal style name, the sheet
|
|
3537
|
+
* name, `phoneticPr`, page margins and, on `mac-*`, the row height and base
|
|
3538
|
+
* column width follow the locale. The workbook's Excel profile is set to
|
|
3539
|
+
* the id. No theme part is written (Excel treats that as the Office theme).
|
|
3540
|
+
* Only `mac-*` values are measured; `win-*` ids are estimates (the Mac
|
|
3541
|
+
* table with an 11 pt body font, no row height or base column width).
|
|
3542
|
+
* `setDefaultFont` afterwards leaves font 1 unchanged. `createDefault`
|
|
3543
|
+
* still seeds Calibri 11. An unknown id returns an invalid wrapper
|
|
3544
|
+
* (`!isValid()`), like a failed `createDefault`. */
|
|
3545
|
+
createForProfile(profileId: string): Workbook;
|
|
3216
3546
|
/** Loads from an in-memory workbook byte buffer, auto-detecting
|
|
3217
3547
|
* `.xlsx` vs `.xlsb` from the package contents (there is no filename
|
|
3218
3548
|
* to route on). The returned wrapper may be invalid (`!isValid()`) on
|
package/dist/formulon.wasm
CHANGED
|
Binary file
|