@jsfkit/types 1.4.0 → 1.5.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 (3) hide show
  1. package/README.md +33 -2
  2. package/dist/index.d.ts +1917 -92
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -9,6 +9,8 @@
9
9
  * | `d` | Date | The {@link Cell.s | cell style} formats the integer cell value as a date |
10
10
  * | `s` | Text | |
11
11
  * | `z` | Empty | Cell is empty |
12
+ *
13
+ * @group Workbooks
12
14
  */
13
15
  type CellValueType = 'b' | 'e' | 'n' | 'd' | 's' | 'z';
14
16
 
@@ -16,6 +18,7 @@ type CellValueType = 'b' | 'e' | 'n' | 'd' | 's' | 'z';
16
18
  * A cell comment.
17
19
  *
18
20
  * @deprecated Use {@link Note | notes} and {@link ThreadedComment | threaded comments} instead.
21
+ * @group Workbooks
19
22
  */
20
23
  type Comment = {
21
24
  /** Author of the comment. */
@@ -33,6 +36,7 @@ type Comment = {
33
36
  * `XFD1048576` inclusive.
34
37
  *
35
38
  * @pattern ^[A-Z]{1,3}[0-9]{1,7}$
39
+ * @group Workbooks
36
40
  */
37
41
  type CellId = string;
38
42
 
@@ -42,12 +46,15 @@ type CellId = string;
42
46
  * The range consists of two {@link CellId | CellIds} separated by a colon (`:`) character.
43
47
  *
44
48
  * @pattern ^([A-Z]{1,3}[0-9]{1,7}):([A-Z]{1,3}[0-9]{1,7})$
49
+ * @group Workbooks
45
50
  */
46
51
  type CellRange = string;
47
52
 
48
53
  /**
49
54
  * Data table configuration, present on the master cell of a data table range.
50
55
  * Represents an Excel What-If Analysis data table.
56
+ *
57
+ * @group Workbooks
51
58
  */
52
59
  type DataTable = {
53
60
  /** Range of cells the data table manages (e.g., "D3:D5") */
@@ -64,11 +71,15 @@ type DataTable = {
64
71
 
65
72
  /**
66
73
  * A whole number without a fractional value.
74
+ *
75
+ * @group Workbooks
67
76
  */
68
77
  type integer = number;
69
78
 
70
79
  /**
71
80
  * A spreadsheet cell.
81
+ *
82
+ * @group Workbooks
72
83
  */
73
84
  type Cell = {
74
85
  /**
@@ -125,6 +136,8 @@ type Cell = {
125
136
  * "scope": "Sheet1",
126
137
  * "value": "Sheet1!B1:C1" }
127
138
  * ```
139
+ *
140
+ * @group Workbooks
128
141
  */
129
142
  type DefinedName = {
130
143
  /**
@@ -150,6 +163,8 @@ type DefinedName = {
150
163
 
151
164
  /**
152
165
  * A simple container sheet for cell values within an external workbook.
166
+ *
167
+ * @group Workbooks
153
168
  */
154
169
  type ExternalWorksheet = {
155
170
  /**
@@ -172,6 +187,8 @@ type ExternalWorksheet = {
172
187
 
173
188
  /**
174
189
  * A cell from another workbook (i.e. another file) that is referenced in this workbook.
190
+ *
191
+ * @group Workbooks
175
192
  */
176
193
  type External = {
177
194
  /** Filename being referenced. */
@@ -196,6 +213,7 @@ type External = {
196
213
  * A numeric value measured in pixels.
197
214
  *
198
215
  * @min 0
216
+ * @group Workbooks
199
217
  */
200
218
  type PixelValue = number;
201
219
 
@@ -209,6 +227,8 @@ type PixelValue = number;
209
227
  * GridSize may have a style-index ({@link GridSize.s}) attribute like individual cells. The styling
210
228
  * information on the column should be used for all cells that are not present in the sheet's cell
211
229
  * collection.
230
+ *
231
+ * @group Workbooks
212
232
  */
213
233
  type GridSize = {
214
234
  /** A 1-based inclusive start index. */
@@ -226,6 +246,8 @@ type GridSize = {
226
246
  *
227
247
  * There is a maximum of one note per cell, and there is no way to reply to a note. For cell
228
248
  * annotations with replies, see {@link ThreadedComment} and {@link Worksheet.comments}.
249
+ *
250
+ * @group Workbooks
229
251
  */
230
252
  type Note = {
231
253
  /** Cell to which the note is attached (e.g. A1, E24). */
@@ -254,6 +276,7 @@ type Note = {
254
276
  *
255
277
  * @see {@link MentionTextRun} for mentions of people
256
278
  * @see {@link HyperlinkTextRun} for hyperlinks
279
+ * @group Workbooks
257
280
  */
258
281
  type TextRun = {
259
282
  /** Starting character position of the run in the text (zero-indexed). */
@@ -264,6 +287,8 @@ type TextRun = {
264
287
 
265
288
  /**
266
289
  * A {@link TextRun | text run} representing a hyperlink within a threaded comment's text.
290
+ *
291
+ * @group Workbooks
267
292
  */
268
293
  type HyperlinkTextRun = TextRun & {
269
294
  /** Discriminator to identify this as a hyperlink text run. */
@@ -274,6 +299,8 @@ type HyperlinkTextRun = TextRun & {
274
299
 
275
300
  /**
276
301
  * A {@link TextRun | text run} representing a mention of a person within a threaded comment's text.
302
+ *
303
+ * @group Workbooks
277
304
  */
278
305
  type MentionTextRun = TextRun & {
279
306
  /** Discriminator to identify this as a mention text run. */
@@ -290,6 +317,8 @@ type MentionTextRun = TextRun & {
290
317
 
291
318
  /**
292
319
  * An author of a threaded comment, or a person mentioned in a threaded comment.
320
+ *
321
+ * @group Workbooks
293
322
  */
294
323
  type Person = {
295
324
  /**
@@ -319,6 +348,8 @@ type Person = {
319
348
 
320
349
  /**
321
350
  * A threaded comment that is attached to an individual cell.
351
+ *
352
+ * @group Workbooks
322
353
  */
323
354
  type ThreadedComment = {
324
355
  /**
@@ -357,15 +388,18 @@ type ThreadedComment = {
357
388
 
358
389
  /**
359
390
  * Represents a one dimensional position or length in EMUs.
360
- * Same as {@link Coordinate} but value must be 0 or higher.
391
+ * Same as {@link EmuValue} but value must be 0 or higher.
361
392
  *
362
393
  * @min 0
363
394
  * @max 27273042316900
395
+ * @group Drawings
364
396
  */
365
397
  type PositiveCoordinate = number;
366
398
 
367
399
  /**
368
400
  * Describes the length and width properties for how far drawing element should extend, in EMUs.
401
+ *
402
+ * @group Drawings
369
403
  */
370
404
  type Extent = {
371
405
  /** Horizontal size (X-axis). */
@@ -397,13 +431,16 @@ type Extent = {
397
431
  *
398
432
  * @min -27273042329600
399
433
  * @max 27273042316900
434
+ * @group Drawings
400
435
  */
401
436
  type EmuValue = number;
402
437
 
403
438
  /**
404
439
  * 2D position in EMUs.
405
440
  *
406
- z * Represents a point in 2D space using absolute coordinates measured in EMUs.
441
+ * Represents a point in 2D space using absolute coordinates measured in EMUs.
442
+ *
443
+ * @group Drawings
407
444
  */
408
445
  type Point = {
409
446
  /** Horizontal position (X-axis). */
@@ -414,6 +451,8 @@ type Point = {
414
451
 
415
452
  /**
416
453
  * Specifies an absolute anchor placeholder for a group, a shape, or a drawing element.
454
+ *
455
+ * @group Drawings
417
456
  */
418
457
  type GraphicAnchorAbsolute = {
419
458
  /** Type discriminator for an absolute anchor. */
@@ -426,6 +465,8 @@ type GraphicAnchorAbsolute = {
426
465
 
427
466
  /**
428
467
  * Specifies a point in the cell grid.
468
+ *
469
+ * @group Drawings
429
470
  */
430
471
  type CellOffset = {
431
472
  /** The row in which the point occurs, 1 indexed. */
@@ -440,6 +481,8 @@ type CellOffset = {
440
481
 
441
482
  /**
442
483
  * Specifies a one cell anchor placeholder for a group, a shape, or a drawing element.
484
+ *
485
+ * @group Drawings
443
486
  */
444
487
  type GraphicAnchorOneCell = {
445
488
  /** Type discriminator for a one-cell anchor. */
@@ -452,6 +495,8 @@ type GraphicAnchorOneCell = {
452
495
 
453
496
  /**
454
497
  * Specifies a two-cell anchor placeholder for a group, a shape, or a drawing element.
498
+ *
499
+ * @group Drawings
455
500
  */
456
501
  type GraphicAnchorTwoCell = {
457
502
  /** Type discriminator for a two-cell anchor. */
@@ -464,11 +509,15 @@ type GraphicAnchorTwoCell = {
464
509
 
465
510
  /**
466
511
  * Specifies an anchor placeholder for a group, a shape, or a drawing element.
512
+ *
513
+ * @group Drawings
467
514
  */
468
515
  type GraphicAnchor = GraphicAnchorAbsolute | GraphicAnchorOneCell | GraphicAnchorTwoCell;
469
516
 
470
517
  /**
471
518
  * Represents a percentage of a whole, usually [0-100].
519
+ *
520
+ * @group Drawings
472
521
  */
473
522
  type Percentage = number;
474
523
 
@@ -477,6 +526,8 @@ type Percentage = number;
477
526
  *
478
527
  * Defines a rectangle using relative offsets from each edge, expressed as percentages
479
528
  * of the parent rectangle's dimensions.
529
+ *
530
+ * @group Drawings
480
531
  */
481
532
  type RelativeRect = {
482
533
  /** Top edge offset as percentage from top. */
@@ -491,6 +542,8 @@ type RelativeRect = {
491
542
 
492
543
  /**
493
544
  * Specifies the direction(s) in which to flip a source image while tiling.
545
+ *
546
+ * @group Drawings
494
547
  */
495
548
  type FlipAxis = 'none' | 'x' | 'xy' | 'y';
496
549
 
@@ -510,6 +563,8 @@ type FlipAxis = 'none' | 'x' | 'xy' | 'y';
510
563
  * | `t` | Top center |
511
564
  * | `tl` | Top left |
512
565
  * | `tr` | Top right |
566
+ *
567
+ * @group Drawings
513
568
  */
514
569
  type RectAlignment = 'b' | 'bl' | 'br' | 'ctr' | 'l' | 'r' | 't' | 'tl' | 'tr';
515
570
 
@@ -518,6 +573,8 @@ type RectAlignment = 'b' | 'bl' | 'br' | 'ctr' | 'l' | 'r' | 't' | 'tl' | 'tr';
518
573
  *
519
574
  * Defines how an image should be repeated (tiled) when used as a fill,
520
575
  * including scaling, alignment, offset, and flip transformations.
576
+ *
577
+ * @group Drawings
521
578
  */
522
579
  type Tile = {
523
580
  /** Additional horizontal offset after alignment, in EMUs. */
@@ -542,6 +599,8 @@ type Tile = {
542
599
  *
543
600
  * Defines a fill using an embedded or linked image, with options for
544
601
  * tiling, stretching, cropping, and transparency.
602
+ *
603
+ * @group Drawings
545
604
  */
546
605
  type BlipFill = {
547
606
  /** Type discriminator for blip (image) fills. */
@@ -582,6 +641,8 @@ type BlipFill = {
582
641
  *
583
642
  * Positive angles are clockwise (i.e., towards the positive y axis);
584
643
  * negative angles are counter-clockwise (i.e., towards the negative y axis).
644
+ *
645
+ * @group Drawings
585
646
  */
586
647
  type DmlAngle = number;
587
648
 
@@ -590,6 +651,7 @@ type DmlAngle = number;
590
651
  *
591
652
  * @see {@link https://www.w3.org/TR/css-color-4/#hex-notation | CSS hexadecimal notation spec}
592
653
  * @pattern ^#([a-fA-F0-9]{3,4}|([a-fA-F0-9][a-fA-F0-9]){3,4})$
654
+ * @group Workbooks
593
655
  */
594
656
  type Color = `#${string}`;
595
657
 
@@ -598,6 +660,8 @@ type Color = `#${string}`;
598
660
  *
599
661
  * Defines a color transition point within a gradient fill,
600
662
  * specifying both the position and color at that point.
663
+ *
664
+ * @group Drawings
601
665
  */
602
666
  type GradientColorStop = {
603
667
  /**
@@ -617,6 +681,8 @@ type GradientColorStop = {
617
681
  *
618
682
  * Defines a gradient fill that transitions between colors along a straight line,
619
683
  * with configurable angle, flip behavior, and color stops.
684
+ *
685
+ * @group Drawings
620
686
  */
621
687
  type GradientLinearFill = {
622
688
  /** Type discriminator for linear gradient fills. */
@@ -640,6 +706,8 @@ type GradientLinearFill = {
640
706
  * - 'circle': Radial gradient emanating from center in a circular pattern.
641
707
  * - 'rect': Gradient following rectangular boundaries from center outward.
642
708
  * - 'shape': Gradient following the actual contour/outline of the shape.
709
+ *
710
+ * @group Drawings
643
711
  */
644
712
  type PathFillType = 'circle' | 'rect' | 'shape';
645
713
 
@@ -648,6 +716,8 @@ type PathFillType = 'circle' | 'rect' | 'shape';
648
716
  *
649
717
  * Defines a gradient fill that radiates from a center point or follows
650
718
  * the shape's contour, creating circular, rectangular, or shape-based gradients.
719
+ *
720
+ * @group Drawings
651
721
  */
652
722
  type GradientPathFill = {
653
723
  /** Type discriminator for path gradient fills. */
@@ -668,6 +738,8 @@ type GradientPathFill = {
668
738
  * Group fill.
669
739
  *
670
740
  * Declares that the element is part of a group and should inherit the fill properties of the group.
741
+ *
742
+ * @group Drawings
671
743
  */
672
744
  type GroupFill = {
673
745
  /** Type discriminator for group fills. */
@@ -678,6 +750,8 @@ type GroupFill = {
678
750
  * No fill.
679
751
  *
680
752
  * Declares that the element should not be filled.
753
+ *
754
+ * @group Drawings
681
755
  */
682
756
  type NoFill = {
683
757
  /** Type discriminator for none-fills. */
@@ -686,6 +760,8 @@ type NoFill = {
686
760
 
687
761
  /**
688
762
  * Pattern fill style presets.
763
+ *
764
+ * @group Drawings
689
765
  */
690
766
  type FillPatternStyle = 'pct5' | 'pct10' | 'pct20' | 'pct25' | 'pct30' | 'pct40' | 'pct50' | 'pct60' | 'pct70' | 'pct75' | 'pct80' | 'pct90' | 'ltHorz' | 'ltVert' | 'dkHorz' | 'dkVert' | 'narHorz' | 'narVert' | 'dashHorz' | 'dashVert' | 'ltDnDiag' | 'ltUpDiag' | 'dkDnDiag' | 'dkUpDiag' | 'wdDnDiag' | 'wdUpDiag' | 'dashDnDiag' | 'dashUpDiag' | 'smCheck' | 'lgCheck' | 'smGrid' | 'lgGrid' | 'dotGrid' | 'smConfetti' | 'lgConfetti' | 'horzBrick' | 'diagBrick' | 'solidDmnd' | 'openDmnd' | 'dotDmnd' | 'plaid' | 'sphere' | 'weave' | 'divot' | 'shingle' | 'wave' | 'trellis' | 'zigZag' | 'cross' | 'horz' | 'vert' | 'dnDiag' | 'upDiag' | 'diagCross';
691
767
 
@@ -694,6 +770,8 @@ type FillPatternStyle = 'pct5' | 'pct10' | 'pct20' | 'pct25' | 'pct30' | 'pct40'
694
770
  *
695
771
  * Defines a fill using a repeating pattern (dots, stripes, crosshatch, etc.)
696
772
  * with configurable foreground and background colors.
773
+ *
774
+ * @group Drawings
697
775
  */
698
776
  type PatternFill = {
699
777
  /** Type discriminator for pattern fills. */
@@ -710,6 +788,8 @@ type PatternFill = {
710
788
  * Solid color fill.
711
789
  *
712
790
  * Defines a fill using a single uniform color with no gradients, patterns, or images.
791
+ *
792
+ * @group Drawings
713
793
  */
714
794
  type SolidFill = {
715
795
  /** Type discriminator for solid fills. */
@@ -718,10 +798,17 @@ type SolidFill = {
718
798
  bg?: Color;
719
799
  };
720
800
 
801
+ /**
802
+ * Union type representing all possible fill types for shapes.
803
+ *
804
+ * @group Drawings
805
+ */
721
806
  type Fill = PatternFill | SolidFill | GradientLinearFill | GradientPathFill | GroupFill | NoFill | BlipFill;
722
807
 
723
808
  /**
724
809
  * A dash stop primitive consisting of a dash and a space.
810
+ *
811
+ * @group Drawings
725
812
  */
726
813
  type DashStop = {
727
814
  /**
@@ -745,6 +832,8 @@ type DashStop = {
745
832
  * | `inside` | Stroke is drawn inside the path.
746
833
  *
747
834
  * These have been altered from DrawingML which used "ctr" for `center`, and "in" for `inside`.
835
+ *
836
+ * @group Drawings
748
837
  */
749
838
  type LineAlignment = 'center' | 'inside';
750
839
 
@@ -759,6 +848,8 @@ type LineAlignment = 'center' | 'inside';
759
848
  *
760
849
  * These have been altered from DrawingML which used "flat" for `butt`, "rnd" for `round`,
761
850
  * and "sq" for `square`.
851
+ *
852
+ * @group Drawings
762
853
  */
763
854
  type LineCapType = 'butt' | 'rnd' | 'sq';
764
855
 
@@ -772,19 +863,29 @@ type LineCapType = 'butt' | 'rnd' | 'sq';
772
863
  * | `thickThin` | Double lines: one thick, one thin
773
864
  * | `thinThick` | Double lines: one thin, one thick
774
865
  * | `tri` | Three lines: thin, thick, thin
866
+ *
867
+ * @group Drawings
775
868
  */
776
869
  type LineCompoundType = 'dbl' | 'sng' | 'thickThin' | 'thinThick' | 'tri';
777
870
 
778
871
  /**
779
872
  * Line ending decoration size: Large, medium, small.
873
+ *
874
+ * @group Drawings
780
875
  */
781
876
  type LineEndSize = 'lg' | 'med' | 'sm';
782
877
 
783
- /** Line ending shape type. */
878
+ /**
879
+ * Line ending shape type.
880
+ *
881
+ * @group Drawings
882
+ */
784
883
  type LineEndType = 'arrow' | 'diamond' | 'none' | 'oval' | 'stealth' | 'triangle';
785
884
 
786
885
  /**
787
886
  * Defines a line ending decoration.
887
+ *
888
+ * @group Drawings
788
889
  */
789
890
  type LineEnd = {
790
891
  /**
@@ -807,6 +908,8 @@ type LineEnd = {
807
908
  /**
808
909
  * Defines the shape to be used at the corners of a stroked path.
809
910
  * These are equivalent to their CSS/SVG linejoin value counterparts.
911
+ *
912
+ * @group Drawings
810
913
  */
811
914
  type LineJoinType = 'bevel' | 'round' | 'miter';
812
915
 
@@ -826,6 +929,8 @@ type LineJoinType = 'bevel' | 'round' | 'miter';
826
929
  * | `sysDashDot` | Equivalent to SVG dashArray of `[3,1,1,1]`
827
930
  * | `sysDashDotDot` | Equivalent to SVG dashArray of `[3,1,1,1,1,1,1]`
828
931
  * | `sysDot` | Equivalent to SVG dashArray of `[1,1]`
932
+ *
933
+ * @group Drawings
829
934
  */
830
935
  type LineStyle = 'dash' | 'dashDot' | 'dot' | 'lgDash' | 'lgDashDot' | 'lgDashDotDot' | 'solid' | 'sysDash' | 'sysDashDot' | 'sysDashDotDot' | 'sysDot';
831
936
 
@@ -834,6 +939,8 @@ type LineStyle = 'dash' | 'dashDot' | 'dot' | 'lgDash' | 'lgDashDot' | 'lgDashDo
834
939
  *
835
940
  * Defines the visual appearance of lines and shape outlines, including
836
941
  * stroke style, width, caps, joins, and decorative line ends (arrows).
942
+ *
943
+ * @group Drawings
837
944
  */
838
945
  type Line = {
839
946
  /** Compound line type for creating multi-stroke effects. */
@@ -873,38 +980,60 @@ type Line = {
873
980
  tail?: LineEnd;
874
981
  };
875
982
 
876
- /** An identifier for a geometry guide */
983
+ /**
984
+ * An identifier for a geometry guide.
985
+ *
986
+ * @group Drawings
987
+ */
877
988
  type GeomGuideName = string;
878
989
 
990
+ /**
991
+ * Defines the type of an adjust coordinate, which can be either an {@link EmuValue} or a
992
+ * {@link GeomGuideName}.
993
+ *
994
+ * @group Drawings
995
+ */
879
996
  type AdjustCoordinate = EmuValue | GeomGuideName;
880
997
 
881
998
  /**
882
999
  * A path command to draw an elliptical arc to an endpoint.
1000
+ *
1001
+ * @group Drawings
883
1002
  */
884
1003
  type ArcToCommand = ['A', AdjustCoordinate, AdjustCoordinate, AdjustCoordinate, AdjustCoordinate];
885
1004
 
886
1005
  /**
887
1006
  * A path command to close the current subpath by drawing a line to the starting point.
1007
+ *
1008
+ * @group Drawings
888
1009
  */
889
1010
  type CloseCommand = ['Z'];
890
1011
 
891
1012
  /**
892
1013
  * A path command to draw a cubic Bézier curve to an endpoint.
1014
+ *
1015
+ * @group Drawings
893
1016
  */
894
1017
  type CubicBezierToCommand = ['C', AdjustCoordinate, AdjustCoordinate, AdjustCoordinate, AdjustCoordinate, AdjustCoordinate, AdjustCoordinate];
895
1018
 
896
1019
  /**
897
1020
  * A path command to draw a line from the current position to a new one.
1021
+ *
1022
+ * @group Drawings
898
1023
  */
899
1024
  type LineToCommand = ['L', AdjustCoordinate, AdjustCoordinate];
900
1025
 
901
1026
  /**
902
1027
  * A path command to move pen to a new position without drawing.
1028
+ *
1029
+ * @group Drawings
903
1030
  */
904
1031
  type MoveToCommand = ['M', AdjustCoordinate, AdjustCoordinate];
905
1032
 
906
1033
  /**
907
1034
  * A path command to draw a quadratic Bézier curve to an endpoint.
1035
+ *
1036
+ * @group Drawings
908
1037
  */
909
1038
  type QuadraticBezierToCommand = ['Q', AdjustCoordinate, AdjustCoordinate, AdjustCoordinate, AdjustCoordinate];
910
1039
 
@@ -912,6 +1041,8 @@ type QuadraticBezierToCommand = ['Q', AdjustCoordinate, AdjustCoordinate, Adjust
912
1041
  * Path command for shape geometry.
913
1042
  *
914
1043
  * Defines a single drawing command in a shape path, using a subset of SVG path commands.
1044
+ *
1045
+ * @group Drawings
915
1046
  */
916
1047
  type PathCommand = ArcToCommand | CloseCommand | CubicBezierToCommand | LineToCommand | MoveToCommand | QuadraticBezierToCommand;
917
1048
 
@@ -926,6 +1057,8 @@ type PathCommand = ArcToCommand | CloseCommand | CubicBezierToCommand | LineToCo
926
1057
  * | `lightenLess` | slightly lighter shaded color applied to its fill.
927
1058
  * | `none` | should have no fill.
928
1059
  * | `norm` | should have a normally shaded color applied to its fill.
1060
+ *
1061
+ * @group Drawings
929
1062
  */
930
1063
  type PathFillMode = 'none' | 'norm' | 'lighten' | 'lightenLess' | 'darken' | 'darkenLess';
931
1064
 
@@ -934,6 +1067,8 @@ type PathFillMode = 'none' | 'norm' | 'lighten' | 'lightenLess' | 'darken' | 'da
934
1067
  *
935
1068
  * Defines a single path within a custom shape's geometry, including
936
1069
  * the path commands and rendering properties for that path.
1070
+ *
1071
+ * @group Drawings
937
1072
  */
938
1073
  type Path = {
939
1074
  /** Whether this path should be stroked (outlined). */
@@ -960,6 +1095,8 @@ type Path = {
960
1095
 
961
1096
  /**
962
1097
  * Defines an inset or internal margins for a text box within a shape.
1098
+ *
1099
+ * @group Drawings
963
1100
  */
964
1101
  type InsetRect = {
965
1102
  /**
@@ -984,7 +1121,11 @@ type InsetRect = {
984
1121
  r?: EmuValue;
985
1122
  };
986
1123
 
987
- /** A paragraph of text. */
1124
+ /**
1125
+ * A paragraph of text.
1126
+ *
1127
+ * @group Drawings
1128
+ */
988
1129
  type Paragraph = {
989
1130
  /** Text content. */
990
1131
  text: string;
@@ -1002,6 +1143,8 @@ type Paragraph = {
1002
1143
  * | `b` | Bottom aligned |
1003
1144
  * | `dist` | Distributed (evenly spaced lines) |
1004
1145
  * | `just` | Justified (stretched to fill container) |
1146
+ *
1147
+ * @group Drawings
1005
1148
  */
1006
1149
  type TextAnchoring = 't' | 'b' | 'ctr' | 'dist' | 'just';
1007
1150
 
@@ -1014,6 +1157,8 @@ type TextAnchoring = 't' | 'b' | 'ctr' | 'dist' | 'just';
1014
1157
  * |------------|-----------------------------------------------|
1015
1158
  * | `overflow` | Text extends beyond container bounds |
1016
1159
  * | `clip` | Text is clipped at container edge |
1160
+ *
1161
+ * @group Drawings
1017
1162
  */
1018
1163
  type TextHorzOverflow = 'overflow' | 'clip';
1019
1164
 
@@ -1029,6 +1174,8 @@ type TextHorzOverflow = 'overflow' | 'clip';
1029
1174
  * | `wordArtVertRtl` | Vertical WordArt should be shown from right to left.
1030
1175
  * | `eaVert` | Some fonts are rotated by 90° while some (East Asian) are shown vertically.
1031
1176
  * | `mongolianVert` | `eaVert` but the text flows top down then LEFT RIGHT, instead of RIGHT LEFT.
1177
+ *
1178
+ * @group Drawings
1032
1179
  */
1033
1180
  type TextVerticalType = 'horz' | 'vert' | 'vert270' | 'wordArtVert' | 'eaVert' | 'mongolianVert' | 'wordArtVertRtl';
1034
1181
 
@@ -1042,6 +1189,8 @@ type TextVerticalType = 'horz' | 'vert' | 'vert270' | 'wordArtVert' | 'eaVert' |
1042
1189
  * | `overflow` | Text extends beyond container bounds |
1043
1190
  * | `ellipsis` | Text is truncated with ellipsis indicator |
1044
1191
  * | `clip` | Text is clipped at container edge |
1192
+ *
1193
+ * @group Drawings
1045
1194
  */
1046
1195
  type TextVertOverflow = 'overflow' | 'ellipsis' | 'clip';
1047
1196
 
@@ -1054,6 +1203,8 @@ type TextVertOverflow = 'overflow' | 'ellipsis' | 'clip';
1054
1203
  * |----------|---------------------------------------------|
1055
1204
  * | `none` | No wrapping (text runs on a single line) |
1056
1205
  * | `square` | Wrap text at container boundaries |
1206
+ *
1207
+ * @group Drawings
1057
1208
  */
1058
1209
  type TextWrapping = 'none' | 'square';
1059
1210
 
@@ -1062,6 +1213,8 @@ type TextWrapping = 'none' | 'square';
1062
1213
  *
1063
1214
  * Defines the text content within a shape, including paragraphs and formatting properties
1064
1215
  * such as alignment, overflow behavior, columns, rotation, and insets.
1216
+ *
1217
+ * @group Drawings
1065
1218
  */
1066
1219
  type TextBody = {
1067
1220
  /**
@@ -1132,6 +1285,13 @@ type TextBody = {
1132
1285
  p: Paragraph[];
1133
1286
  };
1134
1287
 
1288
+ /**
1289
+ * Represents a point that can be adjusted in a shape. Each coordinate (x and y) can be defined as
1290
+ * an {@link AdjustCoordinate}, which allows for flexible positioning based on the shape's
1291
+ * dimensions and other factors.
1292
+ *
1293
+ * @group Drawings
1294
+ */
1135
1295
  type AdjustPoint = {
1136
1296
  x: AdjustCoordinate;
1137
1297
  y: AdjustCoordinate;
@@ -1142,6 +1302,8 @@ type AdjustPoint = {
1142
1302
  *
1143
1303
  * Defines an interactive handle that can be dragged to adjust shape geometry
1144
1304
  * using polar coordinates (angle and radius from a center point).
1305
+ *
1306
+ * @group Drawings
1145
1307
  */
1146
1308
  type AdjustValueHandlePolar = {
1147
1309
  /** Type discriminator for polar adjustment handles. */
@@ -1167,6 +1329,8 @@ type AdjustValueHandlePolar = {
1167
1329
  *
1168
1330
  * Defines an interactive handle that can be dragged to adjust shape geometry
1169
1331
  * using Cartesian coordinates (X and Y positions).
1332
+ *
1333
+ * @group Drawings
1170
1334
  */
1171
1335
  type AdjustValueHandleXY = {
1172
1336
  /** Type discriminator for XY adjustment handles. */
@@ -1203,12 +1367,16 @@ type AdjustValueHandleXY = {
1203
1367
  * | `invGray` (Inverse Gray) | Rendered with inverse gray coloring
1204
1368
  * | `ltGray` (Light Gray) | Rendered with light gray coloring
1205
1369
  * | `white` (White) | Rendered within white coloring
1370
+ *
1371
+ * @group Drawings
1206
1372
  */
1207
1373
  type BlackWhiteMode = 'clr' | 'auto' | 'gray' | 'ltGray' | 'invGray' | 'grayWhite' | 'blackGray' | 'blackWhite' | 'black' | 'white' | 'hidden';
1208
1374
 
1209
1375
  /**
1210
1376
  * Defines a connection point on a shape where other shapes can connect.
1211
1377
  * Connection points are used for connecting shapes with connectors/lines in diagrams.
1378
+ *
1379
+ * @group Drawings
1212
1380
  */
1213
1381
  type ConnectionPoint = {
1214
1382
  /** The position of the connection point on the shape */
@@ -1220,6 +1388,11 @@ type ConnectionPoint = {
1220
1388
  ang?: DmlAngle | GeomGuideName;
1221
1389
  };
1222
1390
 
1391
+ /**
1392
+ * Represents the index of a font style in a drawing.
1393
+ *
1394
+ * @group Drawings
1395
+ */
1223
1396
  type FontStyleIndex = 'major' | 'minor' | 'none';
1224
1397
 
1225
1398
  /**
@@ -1227,6 +1400,8 @@ type FontStyleIndex = 'major' | 'minor' | 'none';
1227
1400
  *
1228
1401
  * Defines a named calculation point that can be referenced in shape paths
1229
1402
  * and used to create parameterized, adjustable geometry.
1403
+ *
1404
+ * @group Drawings
1230
1405
  */
1231
1406
  type GuidePoint = {
1232
1407
  /**
@@ -1244,6 +1419,8 @@ type GuidePoint = {
1244
1419
  *
1245
1420
  * Defines the inset rectangle within a shape where text should be positioned,
1246
1421
  * specified using adjustable coordinates relative to the shape's geometry.
1422
+ *
1423
+ * @group Drawings
1247
1424
  */
1248
1425
  type ShapeRect = {
1249
1426
  /** Top edge inset from shape bounds. */
@@ -1258,6 +1435,8 @@ type ShapeRect = {
1258
1435
 
1259
1436
  /**
1260
1437
  * Transform directions to be applied to drawn graphic objects.
1438
+ *
1439
+ * @group Drawings
1261
1440
  */
1262
1441
  type Xfrm = {
1263
1442
  /**
@@ -1278,6 +1457,9 @@ type Xfrm = {
1278
1457
  ext?: Extent;
1279
1458
  };
1280
1459
 
1460
+ /**
1461
+ * @group Drawings
1462
+ */
1281
1463
  type ShapeStyle = {
1282
1464
  line?: {
1283
1465
  color: Color;
@@ -1302,6 +1484,8 @@ type ShapeStyle = {
1302
1484
  *
1303
1485
  * Defines the complete visual styling and custom geometry for a shape,
1304
1486
  * including fill, line, transformation, custom paths, and interactive handles.
1487
+ *
1488
+ * @group Drawings
1305
1489
  */
1306
1490
  type Shape = {
1307
1491
  /** 2D transformation (position, rotation, scale). */
@@ -1332,6 +1516,8 @@ type Shape = {
1332
1516
 
1333
1517
  /**
1334
1518
  * Bitmap graphic / Picture.
1519
+ *
1520
+ * @group Drawings
1335
1521
  */
1336
1522
  type GraphicBitmap = {
1337
1523
  /** Type discriminator for bitmap graphics. */
@@ -1370,6 +1556,8 @@ type GraphicBitmap = {
1370
1556
 
1371
1557
  /**
1372
1558
  * A chart or plot.
1559
+ *
1560
+ * @group Drawings
1373
1561
  */
1374
1562
  type GraphicChart = {
1375
1563
  /** Type discriminator for a chart. */
@@ -1389,6 +1577,8 @@ type GraphicChart = {
1389
1577
  *
1390
1578
  * Represents a connector or line shape that connects two other shapes,
1391
1579
  * typically used for creating diagrams, flowcharts, and organizational charts.
1580
+ *
1581
+ * @group Drawings
1392
1582
  */
1393
1583
  type GraphicConnectionShape = {
1394
1584
  /** Type discriminator for connection shapes. */
@@ -1407,6 +1597,8 @@ type GraphicConnectionShape = {
1407
1597
 
1408
1598
  /**
1409
1599
  * Transform directions to be applied to group objects.
1600
+ *
1601
+ * @group Drawings
1410
1602
  */
1411
1603
  type XfrmGroup = Xfrm & {
1412
1604
  /** Child offset - position of child elements within a group. */
@@ -1420,6 +1612,8 @@ type XfrmGroup = Xfrm & {
1420
1612
  *
1421
1613
  * Represents a collection of graphic objects grouped together as a single unit,
1422
1614
  * allowing them to be transformed, moved, and manipulated collectively.
1615
+ *
1616
+ * @group Drawings
1423
1617
  */
1424
1618
  type GraphicGroup = {
1425
1619
  /** Type discriminator for group shapes. */
@@ -1439,6 +1633,8 @@ type GraphicGroup = {
1439
1633
  *
1440
1634
  * Represents a standard geometric shape (rectangle, circle, arrow, etc.)
1441
1635
  * with customizable geometry, styling, and text content.
1636
+ *
1637
+ * @group Drawings
1442
1638
  */
1443
1639
  type GraphicShape = {
1444
1640
  /** Type discriminator for basic shapes. */
@@ -1455,7 +1651,11 @@ type GraphicShape = {
1455
1651
  text?: TextBody;
1456
1652
  };
1457
1653
 
1458
- /** A graphic element. */
1654
+ /**
1655
+ * A graphic element.
1656
+ *
1657
+ * @group Drawings
1658
+ */
1459
1659
  type Graphic = GraphicChart | GraphicBitmap | GraphicShape | GraphicConnectionShape | GraphicGroup;
1460
1660
 
1461
1661
  /**
@@ -1463,6 +1663,8 @@ type Graphic = GraphicChart | GraphicBitmap | GraphicShape | GraphicConnectionSh
1463
1663
  *
1464
1664
  * A drawing is a collection of any graphic objects that should be displayed in a worksheet as
1465
1665
  * well as information on how they are positioned within the cell-grid.
1666
+ *
1667
+ * @group Drawings
1466
1668
  */
1467
1669
  type Drawing = {
1468
1670
  /** Defines how the drawing is placed onto a worksheet's cell-grid. */
@@ -1474,6 +1676,8 @@ type Drawing = {
1474
1676
  /**
1475
1677
  * The style to use when drawing a cell border. If the worksheet's zoom factor is changed the width
1476
1678
  * of the border is expected to stay the same.
1679
+ *
1680
+ * @group Workbooks
1477
1681
  */
1478
1682
  type BorderStyle =
1479
1683
  /** No border is drawn.*/
@@ -1510,6 +1714,8 @@ type BorderStyle =
1510
1714
 
1511
1715
  /**
1512
1716
  * Specifies the horizontal alignment of content (text) within a container (cell).
1717
+ *
1718
+ * @group Workbooks
1513
1719
  */
1514
1720
  type HAlign =
1515
1721
  /**
@@ -1545,19 +1751,29 @@ type HAlign =
1545
1751
  /**
1546
1752
  * The style of fill pattern used for a cell background. If the worksheets zoom factor is changed
1547
1753
  * the pixel scale of the pattern is still expected to stay the same.
1754
+ *
1755
+ * @group Workbooks
1548
1756
  */
1549
1757
  type PatternStyle = 'none' | 'solid' | 'mediumGray' | 'darkGray' | 'lightGray' | 'darkHorizontal' | 'darkVertical' | 'darkDown' | 'darkUp' | 'darkGrid' | 'darkTrellis' | 'lightHorizontal' | 'lightVertical' | 'lightDown' | 'lightUp' | 'lightGrid' | 'lightTrellis' | 'gray125' | 'gray0625';
1550
1758
 
1551
1759
  /**
1552
1760
  * Which type of underline to use when rendering text.
1761
+ *
1762
+ * @group Workbooks
1553
1763
  */
1554
1764
  type Underline = 'none' | 'single' | 'singleAccounting' | 'double' | 'doubleAccounting';
1555
1765
 
1556
- /** Vertical alignment of a cell content. */
1766
+ /**
1767
+ * Vertical alignment of a cell content.
1768
+ *
1769
+ * @group Workbooks
1770
+ */
1557
1771
  type VAlign = 'bottom' | 'top' | 'center' | 'justify' | 'distributed';
1558
1772
 
1559
1773
  /**
1560
1774
  * Style rules that specify the visual presentation of a cell.
1775
+ *
1776
+ * @group Workbooks
1561
1777
  */
1562
1778
  type Style = {
1563
1779
  /**
@@ -1688,11 +1904,17 @@ type Style = {
1688
1904
  numberFormat?: string;
1689
1905
  };
1690
1906
 
1691
- /** Describes the type of values found in the cells of a table column. */
1907
+ /**
1908
+ * Describes the type of values found in the cells of a table column.
1909
+ *
1910
+ * @group Workbooks
1911
+ */
1692
1912
  type TableColumnDataType = 'text' | 'number' | 'boolean' | 'datetime' | 'unknown';
1693
1913
 
1694
1914
  /**
1695
1915
  * Describes a column within a table.
1916
+ *
1917
+ * @group Workbooks
1696
1918
  */
1697
1919
  type TableColumn = {
1698
1920
  /**
@@ -1714,12 +1936,18 @@ type TableColumn = {
1714
1936
  formula?: string;
1715
1937
  };
1716
1938
 
1717
- /** Excel's built-in table style names. */
1939
+ /**
1940
+ * Excel's built-in table style names.
1941
+ *
1942
+ * @group Workbooks
1943
+ */
1718
1944
  type TableStyleName = 'TableStyleDark1' | 'TableStyleDark2' | 'TableStyleDark3' | 'TableStyleDark4' | 'TableStyleDark5' | 'TableStyleDark6' | 'TableStyleDark7' | 'TableStyleDark8' | 'TableStyleDark9' | 'TableStyleDark10' | 'TableStyleDark11' | 'TableStyleLight1' | 'TableStyleLight2' | 'TableStyleLight3' | 'TableStyleLight4' | 'TableStyleLight5' | 'TableStyleLight6' | 'TableStyleLight7' | 'TableStyleLight8' | 'TableStyleLight9' | 'TableStyleLight10' | 'TableStyleLight11' | 'TableStyleLight12' | 'TableStyleLight13' | 'TableStyleLight14' | 'TableStyleLight15' | 'TableStyleLight16' | 'TableStyleLight17' | 'TableStyleLight18' | 'TableStyleLight19' | 'TableStyleLight20' | 'TableStyleLight21' | 'TableStyleMedium1' | 'TableStyleMedium2' | 'TableStyleMedium3' | 'TableStyleMedium4' | 'TableStyleMedium5' | 'TableStyleMedium6' | 'TableStyleMedium7' | 'TableStyleMedium8' | 'TableStyleMedium9' | 'TableStyleMedium10' | 'TableStyleMedium11' | 'TableStyleMedium12' | 'TableStyleMedium13' | 'TableStyleMedium14' | 'TableStyleMedium15' | 'TableStyleMedium16' | 'TableStyleMedium17' | 'TableStyleMedium18' | 'TableStyleMedium19' | 'TableStyleMedium20' | 'TableStyleMedium21' | 'TableStyleMedium22' | 'TableStyleMedium23' | 'TableStyleMedium24' | 'TableStyleMedium25' | 'TableStyleMedium26' | 'TableStyleMedium27' | 'TableStyleMedium28';
1719
1945
 
1720
1946
  /**
1721
1947
  * Describes which style is used to display this table, and specifies which portions of the table
1722
1948
  * have which styles applied.
1949
+ *
1950
+ * @group Workbooks
1723
1951
  */
1724
1952
  type TableStyle = {
1725
1953
  /**
@@ -1763,6 +1991,7 @@ type TableStyle = {
1763
1991
  * calculated columns.
1764
1992
  *
1765
1993
  * @see {@link https://support.microsoft.com/office/f5ed2452-2337-4f71-bed3-c8ae6d2b276e}
1994
+ * @group Workbooks
1766
1995
  */
1767
1996
  type Table = {
1768
1997
  /**
@@ -1806,128 +2035,1718 @@ type Table = {
1806
2035
  };
1807
2036
 
1808
2037
  /**
1809
- * Directions on how formulas should be recalculated in the workbook.
2038
+ * The axis a pivot field can be placed on.
2039
+ *
2040
+ * @group PivotTables
1810
2041
  */
1811
- type CalcProps = {
2042
+ type PivotFieldAxis = 'row' | 'col' | 'page';
2043
+
2044
+ /**
2045
+ * The axis a pivot area targets. Extends {@link PivotFieldAxis} with an additional `'values'`
2046
+ * option for the data-values axis.
2047
+ *
2048
+ * @group PivotTables
2049
+ */
2050
+ type PivotAreaAxis = PivotFieldAxis | 'values';
2051
+
2052
+ /**
2053
+ * A reference within a pivot area, identifying specific field items that define the area's scope.
2054
+ *
2055
+ * @group PivotTables
2056
+ */
2057
+ type PivotAreaReference = {
1812
2058
  /**
1813
- * Specifies whether an attempt should be made to calculate formulas that contain circular
1814
- * references. Defaults to `false` in Excel.
2059
+ * Index of the field this reference applies to.
2060
+ * The special value `4294967294` (0xFFFFFFFE) refers to the data (values) field.
1815
2061
  */
1816
- iterate: boolean;
2062
+ field?: integer;
1817
2063
  /**
1818
- * The maximum number of calculation iterations, when {@link CalcProps.iterate} is `true`.
1819
- * Defaults to `100` in Excel.
2064
+ * Whether this reference participates in the selection. When false, the reference
2065
+ * constrains the area without being selected itself.
2066
+ *
2067
+ * @default true
1820
2068
  */
1821
- iterateCount: integer;
2069
+ selected?: boolean;
1822
2070
  /**
1823
- * When a calculation iteration results in an absolute change that is less than iterateDelta,
1824
- * then no further iterations should be attempted. Defaults to `0.001` in Excel.
2071
+ * Whether item indices are positional (absolute row/column position)
2072
+ * rather than field-item-based.
2073
+ *
2074
+ * @default false
1825
2075
  */
1826
- iterateDelta: number;
2076
+ byPosition?: boolean;
1827
2077
  /**
1828
- * Which of the two date systems the workbook uses. 1900 is the default.
2078
+ * Whether the reference is relative to the pivot table's origin.
1829
2079
  *
1830
- * @see {@link https://support.microsoft.com/office/e7fe7167-48a9-4b96-bb53-5612a800b487 | Date systems in Excel}
2080
+ * @default false
1831
2081
  */
1832
- epoch?: 1900 | 1904;
2082
+ relative?: boolean;
1833
2083
  /**
1834
- * The calculation mode for the workbook.
2084
+ * Whether the default subtotal is included.
1835
2085
  *
1836
- * - `"auto"` (default when absent): recalculate all formulas automatically.
1837
- * - `"autoNoTable"`: recalculate automatically but exclude data tables.
1838
- * - `"manual"`: formulas are only recalculated when explicitly triggered.
2086
+ * @default false
2087
+ */
2088
+ defaultSubtotal?: boolean;
2089
+ /**
2090
+ * Whether the sum subtotal is included.
1839
2091
  *
1840
- * @defaultValue "auto"
2092
+ * @default false
1841
2093
  */
1842
- calcMode?: 'auto' | 'autoNoTable' | 'manual';
1843
- };
1844
-
1845
- /**
1846
- * A collection of default properties that apply to cells, rows, or columns in the worksheet.
1847
- */
1848
- type WorksheetDefaults = {
1849
- /** Default width of the UI-grid column. */
1850
- colWidth: PixelValue;
1851
- /** Default height of the UI-grid height. */
1852
- rowHeight: PixelValue;
1853
- };
1854
-
1855
- /**
1856
- * Visual scale (aka zoom level, aka magnification) applied when displaying a worksheet.
1857
- *
1858
- * Each of the three layouts has its own scale. A scale is represented as a percentage, with `100`
1859
- * (100%) being the default 1:1 scale. When a layout has no explicit scale, use 100%.
1860
- */
1861
- type WorksheetLayoutScales = {
2094
+ sumSubtotal?: boolean;
1862
2095
  /**
1863
- * Zoom level for normal view.
2096
+ * Whether the countA subtotal is included.
1864
2097
  *
1865
- * @min 10
1866
- * @max 400
1867
- * @defaultValue 100
1868
- * */
1869
- normal?: integer;
2098
+ * @default false
2099
+ */
2100
+ countASubtotal?: boolean;
1870
2101
  /**
1871
- * Zoom level for page layout view.
2102
+ * Whether the average subtotal is included.
1872
2103
  *
1873
- * @min 10
1874
- * @max 400
1875
- * @defaultValue 100
2104
+ * @default false
1876
2105
  */
1877
- pageLayout?: integer;
2106
+ avgSubtotal?: boolean;
1878
2107
  /**
1879
- * Zoom level for page break preview (aka sheet layout view).
2108
+ * Whether the max subtotal is included.
1880
2109
  *
1881
- * @min 10
1882
- * @max 400
1883
- * @defaultValue 100
2110
+ * @default false
1884
2111
  */
1885
- pageBreakPreview?: integer;
2112
+ maxSubtotal?: boolean;
2113
+ /**
2114
+ * Whether the min subtotal is included.
2115
+ *
2116
+ * @default false
2117
+ */
2118
+ minSubtotal?: boolean;
2119
+ /**
2120
+ * Whether the product subtotal is included.
2121
+ *
2122
+ * @default false
2123
+ */
2124
+ productSubtotal?: boolean;
2125
+ /**
2126
+ * Whether the count subtotal is included.
2127
+ *
2128
+ * @default false
2129
+ */
2130
+ countSubtotal?: boolean;
2131
+ /**
2132
+ * Whether the standard deviation subtotal is included.
2133
+ *
2134
+ * @default false
2135
+ */
2136
+ stdDevSubtotal?: boolean;
2137
+ /**
2138
+ * Whether the population standard deviation subtotal is included.
2139
+ *
2140
+ * @default false
2141
+ */
2142
+ stdDevPSubtotal?: boolean;
2143
+ /**
2144
+ * Whether the variance subtotal is included.
2145
+ *
2146
+ * @default false
2147
+ */
2148
+ varSubtotal?: boolean;
2149
+ /**
2150
+ * Whether the population variance subtotal is included.
2151
+ *
2152
+ * @default false
2153
+ */
2154
+ varPSubtotal?: boolean;
2155
+ /** Indices of the field items included in this reference. */
2156
+ itemIndices?: integer[];
1886
2157
  };
1887
2158
 
1888
2159
  /**
1889
- * A worksheet view.
1890
- *
1891
- * A worksheet view is a display configuration for a particular worksheet. Worksheet view settings
1892
- * can include:
2160
+ * The type of pivot area targeted.
1893
2161
  *
1894
- * - Active cell
1895
- * - Selected ranges
1896
- * - View type (normal, page layout, or page break layout)
1897
- * - Zoom level
2162
+ * @group PivotTables
2163
+ */
2164
+ type PivotAreaType = 'none' | 'normal' | 'data' | 'all' | 'origin' | 'button' | 'topRight';
2165
+
2166
+ /**
2167
+ * Describes a region of a pivot table, used to target formatting, conditional formatting,
2168
+ * and other area-specific features.
1898
2169
  *
1899
- * Currently JSF does not include all available settings for a worksheet.
2170
+ * @group PivotTables
1900
2171
  */
1901
- type WorksheetView = {
2172
+ type PivotArea = {
1902
2173
  /**
1903
- * The id of the workbook view this worksheet view belongs to.
2174
+ * The type of area.
1904
2175
  *
1905
- * This is a zero-based index of the workbook view, as stored in the {@link Workbook.views} array.
2176
+ * @default 'normal'
2177
+ */
2178
+ type?: PivotAreaType;
2179
+ /** The field index this area applies to. */
2180
+ field?: integer;
2181
+ /**
2182
+ * Whether the area applies only to data cells (excluding labels).
1906
2183
  *
1907
- * Within a single worksheet, each view must reference a distinct workbook view (i.e. no two views
1908
- * in the same worksheet can share the same `workbookView` id). However, views from different
1909
- * worksheets may reference the same workbook view.
2184
+ * @default true
1910
2185
  */
1911
- workbookView: integer;
1912
- /** Cell that is selected by default when the sheet is visible. */
1913
- activeCell?: CellId;
1914
- /** Ranges of cells that are selected by default when the sheet is visible. */
1915
- activeRanges?: CellRange[];
2186
+ dataOnly?: boolean;
1916
2187
  /**
1917
- * The layout used to display the worksheet.
2188
+ * Whether the area applies only to label cells (excluding data).
1918
2189
  *
1919
- * @defaultValue "normal"
2190
+ * @default false
1920
2191
  */
1921
- activeLayout?: 'normal' | 'pageLayout' | 'pageBreakPreview';
2192
+ labelOnly?: boolean;
1922
2193
  /**
1923
- * Scale (aka zoom level, aka magnification) applied when displaying a worksheet. Each different
1924
- * layout has its own scale.
2194
+ * Whether the row grand total is included.
2195
+ *
2196
+ * @default false
1925
2197
  */
1926
- layoutScales?: WorksheetLayoutScales;
1927
- };
2198
+ grandRow?: boolean;
2199
+ /**
2200
+ * Whether the column grand total is included.
2201
+ *
2202
+ * @default false
2203
+ */
2204
+ grandCol?: boolean;
2205
+ /**
2206
+ * Whether item indices refer to cache field items rather than pivot field items.
2207
+ *
2208
+ * @default false
2209
+ */
2210
+ cacheIndex?: boolean;
2211
+ /**
2212
+ * Whether the area includes outline-mode items.
2213
+ *
2214
+ * @default true
2215
+ */
2216
+ outline?: boolean;
2217
+ /** A cell reference offset relative to the pivot table's top-left corner. */
2218
+ offset?: string;
2219
+ /**
2220
+ * Whether collapsed hierarchy levels are treated as subtotals.
2221
+ *
2222
+ * @default false
2223
+ */
2224
+ collapsedLevelsAreSubtotals?: boolean;
2225
+ /** The axis this area targets. */
2226
+ axis?: PivotAreaAxis;
2227
+ /** The position of the field on its axis (0-based). */
2228
+ fieldPosition?: integer;
2229
+ /** References that narrow the area to specific field items. */
2230
+ references?: PivotAreaReference[];
2231
+ };
2232
+
2233
+ /**
2234
+ * Comparison operator for a custom auto-filter criterion.
2235
+ *
2236
+ * @group PivotTables
2237
+ */
2238
+ type PivotCustomFilterOperator = 'lessThan' | 'lessThanOrEqual' | 'equal' | 'notEqual' | 'greaterThanOrEqual' | 'greaterThan';
2239
+
2240
+ /**
2241
+ * A single criterion within a custom auto-filter, specifying an operator and comparison value.
2242
+ *
2243
+ * @group PivotTables
2244
+ */
2245
+ type PivotCustomFilterCriterion = {
2246
+ operator?: PivotCustomFilterOperator;
2247
+ val?: string;
2248
+ };
2249
+
2250
+ /**
2251
+ * A filter column within an auto-filter, specifying the filter criteria for a single column.
2252
+ *
2253
+ * @group PivotTables
2254
+ */
2255
+ type PivotAutoFilterColumn = {
2256
+ /** The 0-based column index within the auto-filter range. */
2257
+ colId: integer;
2258
+ /** Top-10 filter: show top/bottom N items by count, percent, or sum. */
2259
+ top10?: {
2260
+ /**
2261
+ * Whether to show the top items (true) or bottom items (false).
2262
+ *
2263
+ * @default true
2264
+ */
2265
+ top?: boolean;
2266
+ /**
2267
+ * Whether filtering is by percent (true) or count (false).
2268
+ *
2269
+ * @default false
2270
+ */
2271
+ percent?: boolean;
2272
+ /** The number of items (or percent) to show. */
2273
+ val: number;
2274
+ /** The actual cutoff value used for filtering. */
2275
+ filterVal?: number;
2276
+ };
2277
+ /** Custom filter criteria (up to two conditions with AND/OR logic). */
2278
+ customFilters?: {
2279
+ /**
2280
+ * Whether the two filters are combined with AND (true) or OR (false).
2281
+ *
2282
+ * @default false
2283
+ */
2284
+ and?: boolean;
2285
+ filters: PivotCustomFilterCriterion[];
2286
+ };
2287
+ };
2288
+
2289
+ /**
2290
+ * The unit used for grouping a cache field's values.
2291
+ *
2292
+ * @group PivotTables
2293
+ */
2294
+ type PivotGroupBy = 'range' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'quarters' | 'years';
2295
+
2296
+ /**
2297
+ * Range grouping properties that define how a cache field's values are grouped into intervals.
2298
+ *
2299
+ * @group PivotTables
2300
+ */
2301
+ type PivotCacheRangePr = {
2302
+ /**
2303
+ * Whether the start value is determined automatically from source data.
2304
+ *
2305
+ * @default true
2306
+ */
2307
+ autoStart?: boolean;
2308
+ /**
2309
+ * Whether the end value is determined automatically from source data.
2310
+ *
2311
+ * @default true
2312
+ */
2313
+ autoEnd?: boolean;
2314
+ /**
2315
+ * The grouping unit.
2316
+ *
2317
+ * @default 'range'
2318
+ */
2319
+ groupBy?: PivotGroupBy;
2320
+ /** Start value for numeric range grouping. */
2321
+ startNum?: number;
2322
+ /** End value for numeric range grouping. */
2323
+ endNum?: number;
2324
+ /** Start date for date range grouping (ISO 8601 datetime string). */
2325
+ startDate?: string;
2326
+ /** End date for date range grouping (ISO 8601 datetime string). */
2327
+ endDate?: string;
2328
+ /**
2329
+ * The interval size for each group.
2330
+ *
2331
+ * @default 1
2332
+ */
2333
+ groupInterval?: number;
2334
+ };
2335
+
2336
+ /**
2337
+ * A shared item value in a pivot cache field. Each item represents a unique value found in the
2338
+ * source data for that field.
2339
+ *
2340
+ * @group PivotTables
2341
+ */
2342
+ type PivotCacheSharedItem = PivotCacheSharedItemStr | PivotCacheSharedItemNum | PivotCacheSharedItemBool | PivotCacheSharedItemDate | PivotCacheSharedItemErr | PivotCacheSharedItemNil;
2343
+ /** A string shared item. @group PivotTables */
2344
+ type PivotCacheSharedItemStr = {
2345
+ t: 's';
2346
+ v: string;
2347
+ };
2348
+ /** A numeric shared item. @group PivotTables */
2349
+ type PivotCacheSharedItemNum = {
2350
+ t: 'n';
2351
+ v: number;
2352
+ };
2353
+ /** A boolean shared item. @group PivotTables */
2354
+ type PivotCacheSharedItemBool = {
2355
+ t: 'b';
2356
+ v: boolean;
2357
+ };
2358
+ /** A date shared item (ISO 8601 string). @group PivotTables */
2359
+ type PivotCacheSharedItemDate = {
2360
+ t: 'd';
2361
+ v: string;
2362
+ };
2363
+ /** An error shared item (e.g. `"#REF!"`). @group PivotTables */
2364
+ type PivotCacheSharedItemErr = {
2365
+ t: 'e';
2366
+ v: string;
2367
+ };
2368
+ /** An empty/missing shared item. @group PivotTables */
2369
+ type PivotCacheSharedItemNil = {
2370
+ t: 'z';
2371
+ };
2372
+
2373
+ /**
2374
+ * Field grouping information that defines how a cache field's values are grouped.
2375
+ *
2376
+ * @group PivotTables
2377
+ */
2378
+ type PivotCacheFieldGroup = {
2379
+ /** Index of the parent grouped field (for multi-level grouping). */
2380
+ par?: integer;
2381
+ /** Index of the base (source) cache field that this grouping is derived from. */
2382
+ base?: integer;
2383
+ /** Range grouping properties (for date or numeric range grouping). */
2384
+ rangePr?: PivotCacheRangePr;
2385
+ /** Discrete grouping: maps each shared item index to its group index. */
2386
+ discretePr?: integer[];
2387
+ /** The group item labels, representing each group's display value. */
2388
+ groupItems?: PivotCacheSharedItem[];
2389
+ };
2390
+
2391
+ /**
2392
+ * Metadata describing the type composition and value range of a cache field's data. These are
2393
+ * redundant when {@link PivotCacheField.sharedItems} contains items (the metadata can be derived),
2394
+ * but for fields whose data is stored only in records (no shared items), they preserve min/max
2395
+ * and type information that would otherwise be lost.
2396
+ *
2397
+ * @group PivotTables
2398
+ */
2399
+ type PivotCacheSharedItemsMeta = {
2400
+ /**
2401
+ * Whether the field contains blank (missing) values.
2402
+ *
2403
+ * @default false
2404
+ */
2405
+ containsBlank?: boolean;
2406
+ /**
2407
+ * Whether the field contains more than one data type (excluding blank and string).
2408
+ *
2409
+ * @default false
2410
+ */
2411
+ containsMixedTypes?: boolean;
2412
+ /**
2413
+ * Whether the field contains a mix of text and other types, or only text.
2414
+ *
2415
+ * @default true
2416
+ */
2417
+ containsSemiMixedTypes?: boolean;
2418
+ /**
2419
+ * Whether the field contains string values.
2420
+ *
2421
+ * @default true
2422
+ */
2423
+ containsString?: boolean;
2424
+ /**
2425
+ * Whether the field contains numeric values.
2426
+ *
2427
+ * @default false
2428
+ */
2429
+ containsNumber?: boolean;
2430
+ /**
2431
+ * Whether the field contains only integer numeric values (no fractions).
2432
+ *
2433
+ * @default false
2434
+ */
2435
+ containsInteger?: boolean;
2436
+ /**
2437
+ * Whether the field contains date values.
2438
+ *
2439
+ * @default false
2440
+ */
2441
+ containsDate?: boolean;
2442
+ /**
2443
+ * Whether the field contains non-date values.
2444
+ *
2445
+ * @default true
2446
+ */
2447
+ containsNonDate?: boolean;
2448
+ /** The minimum numeric value in the field. */
2449
+ minValue?: number;
2450
+ /** The maximum numeric value in the field. */
2451
+ maxValue?: number;
2452
+ /** The minimum date value in the field (ISO 8601 datetime string). */
2453
+ minDate?: string;
2454
+ /** The maximum date value in the field (ISO 8601 datetime string). */
2455
+ maxDate?: string;
2456
+ };
2457
+
2458
+ /**
2459
+ * Describes a field (column) in a pivot cache. Each cache field corresponds to a column in the
2460
+ * source data range.
2461
+ *
2462
+ * @group PivotTables
2463
+ */
2464
+ type PivotCacheField = {
2465
+ /** The name of the field, typically matching the column header in the source data. */
2466
+ name: string;
2467
+ /**
2468
+ * The unique values found in this field's source data. Used for item indexing in pivot cache
2469
+ * records and pivot field items.
2470
+ */
2471
+ sharedItems?: PivotCacheSharedItem[];
2472
+ /**
2473
+ * Metadata about the shared items or record-level values for this field. When
2474
+ * {@link sharedItems} is populated, this can be derived from the items; when absent, it
2475
+ * preserves type/range information that would otherwise be lost.
2476
+ */
2477
+ sharedItemsMeta?: PivotCacheSharedItemsMeta;
2478
+ /** The number format code for this field's values (e.g. `"General"`, `"#,##0"`). */
2479
+ numFmt?: string;
2480
+ /** A formula for a calculated field, expressed in A1-style notation. */
2481
+ formula?: string;
2482
+ /**
2483
+ * Whether this field comes from the source database. When `false`, the field is a calculated
2484
+ * field not present in the original data source.
2485
+ *
2486
+ * @default true
2487
+ */
2488
+ databaseField?: boolean;
2489
+ /** Grouping information for this field (date ranges, numeric ranges, or discrete groups). */
2490
+ fieldGroup?: PivotCacheFieldGroup;
2491
+ };
2492
+
2493
+ /**
2494
+ * A single value in a pivot cache record. Each record is an array of these values, one per cache
2495
+ * field.
2496
+ *
2497
+ * Each value is either an inline {@link PivotCacheSharedItem} or an `{ x: integer }` shared item
2498
+ * index, referring to an entry in the corresponding field's
2499
+ * {@link PivotCacheField.sharedItems | sharedItems} array.
2500
+ *
2501
+ * @group PivotTables
2502
+ */
2503
+ type PivotCacheRecordValue = PivotCacheSharedItem | {
2504
+ t: 'x';
2505
+ v: integer;
2506
+ };
2507
+
2508
+ /**
2509
+ * A single record (row) of cached source data, with one value per cache field.
2510
+ *
2511
+ * @group PivotTables
2512
+ */
2513
+ type PivotCacheRecord = PivotCacheRecordValue[];
2514
+
2515
+ /**
2516
+ * Shared properties for all pivot cache source types.
2517
+ *
2518
+ * @group PivotTables
2519
+ */
2520
+ type PivotCacheBase = {
2521
+ /**
2522
+ * The fields (columns) in the cache, in source-data order. Each entry parallels the
2523
+ * corresponding pivot table's {@link PivotTable.fields | fields} array by index.
2524
+ */
2525
+ fields: PivotCacheField[];
2526
+ /**
2527
+ * The cached data records. Each record is an array of values corresponding to the cache fields.
2528
+ * When absent, the pivot table relies on the source data directly.
2529
+ */
2530
+ records?: PivotCacheRecord[];
2531
+ /**
2532
+ * Name of the user who last refreshed the cache.
2533
+ */
2534
+ refreshedBy?: string;
2535
+ /**
2536
+ * When the cache was last refreshed, as a serial date number (e.g. `39536.657`).
2537
+ */
2538
+ refreshedDate?: number;
2539
+ /**
2540
+ * Whether the cache is refreshed on file open.
2541
+ *
2542
+ * @default false
2543
+ */
2544
+ refreshOnLoad?: boolean;
2545
+ /**
2546
+ * Whether refresh is enabled for this cache.
2547
+ *
2548
+ * @default true
2549
+ */
2550
+ enableRefresh?: boolean;
2551
+ /**
2552
+ * Whether the cache definition is upgraded when refreshed.
2553
+ *
2554
+ * @default false
2555
+ */
2556
+ upgradeOnRefresh?: boolean;
2557
+ /**
2558
+ * Revision-tracking unique identifier. A GUID string like
2559
+ * `"{93AACE53-8F3A-A04A-893A-A439866B3165}"` assigned by Excel 2014+ for revision tracking.
2560
+ */
2561
+ uid?: string;
2562
+ };
2563
+
2564
+ /**
2565
+ * One of the source ranges in a consolidation-source pivot cache.
2566
+ *
2567
+ * @group PivotTables
2568
+ */
2569
+ type PivotCacheConsolidationRangeSet = {
2570
+ /** The A1-style range reference. */
2571
+ ref?: CellRange;
2572
+ /** The sheet containing this range. */
2573
+ sheet?: string;
2574
+ /** Index into the first page field's items. */
2575
+ i1?: integer;
2576
+ /** Index into the second page field's items. */
2577
+ i2?: integer;
2578
+ /** Index into the third page field's items. */
2579
+ i3?: integer;
2580
+ /** Index into the fourth page field's items. */
2581
+ i4?: integer;
2582
+ };
2583
+
2584
+ /**
2585
+ * Describes the source of a pivot cache's data when it consolidates multiple ranges (via the
2586
+ * legacy PivotTable Wizard).
2587
+ *
2588
+ * @group PivotTables
2589
+ */
2590
+ type PivotCacheConsolidationSource = {
2591
+ /**
2592
+ * Whether Excel automatically creates page fields.
2593
+ *
2594
+ * @default true
2595
+ */
2596
+ autoPage?: boolean;
2597
+ /** Page fields. Each inner array is one page field's item names. Up to 4. */
2598
+ pages?: string[][];
2599
+ /** The source ranges being consolidated. */
2600
+ rangeSets: PivotCacheConsolidationRangeSet[];
2601
+ };
2602
+
2603
+ /**
2604
+ * A pivot cache whose source data consolidates multiple ranges.
2605
+ *
2606
+ * @group PivotTables
2607
+ */
2608
+ type PivotCacheConsolidation = PivotCacheBase & {
2609
+ sourceType: 'consolidation';
2610
+ consolidation: PivotCacheConsolidationSource;
2611
+ };
2612
+
2613
+ /**
2614
+ * A pivot cache whose source data comes from an external data connection.
2615
+ *
2616
+ * @group PivotTables
2617
+ */
2618
+ type PivotCacheExternal = PivotCacheBase & {
2619
+ sourceType: 'external';
2620
+ connectionId: integer;
2621
+ };
2622
+
2623
+ /**
2624
+ * A pivot cache whose source data comes from scenarios.
2625
+ *
2626
+ * @group PivotTables
2627
+ */
2628
+ type PivotCacheScenario = PivotCacheBase & {
2629
+ sourceType: 'scenario';
2630
+ };
2631
+
2632
+ /**
2633
+ * A worksheet range source, identified by a cell range and sheet name.
2634
+ *
2635
+ * @group PivotTables
2636
+ */
2637
+ type PivotCacheWorksheetSourceRange = {
2638
+ /** Type discriminator for a worksheet range source. */
2639
+ type: 'range';
2640
+ /** The A1-style range reference to the source data, including headers. */
2641
+ ref: CellRange;
2642
+ /** The name of the sheet containing the source data. */
2643
+ sheet?: string;
2644
+ };
2645
+ /**
2646
+ * A named source (defined name or table), optionally scoped to a sheet.
2647
+ *
2648
+ * @group PivotTables
2649
+ */
2650
+ type PivotCacheWorksheetSourceName = {
2651
+ /** Type discriminator for a worksheet name source. */
2652
+ type: 'name';
2653
+ /** A defined name or table name that identifies the source data. */
2654
+ name: string;
2655
+ /** The name of the sheet, when `name` is a sheet-scoped defined name. */
2656
+ sheet?: string;
2657
+ };
2658
+ /**
2659
+ * Describes the source of a pivot cache's data when the source is a worksheet range or named
2660
+ * range/table. Either `ref` + `sheet` identifies a cell range, or `name` identifies a defined
2661
+ * name or table (with optional `sheet` for sheet-scoped names).
2662
+ *
2663
+ * @group PivotTables
2664
+ */
2665
+ type PivotCacheWorksheetSource = PivotCacheWorksheetSourceRange | PivotCacheWorksheetSourceName;
2666
+
2667
+ /**
2668
+ * A pivot cache whose source data comes from a worksheet range or named range/table.
2669
+ *
2670
+ * @group PivotTables
2671
+ */
2672
+ type PivotCacheWorksheet = PivotCacheBase & {
2673
+ sourceType: 'worksheet';
2674
+ worksheetSource: PivotCacheWorksheetSource;
2675
+ };
2676
+
2677
+ /**
2678
+ * A pivot cache stores a snapshot of the source data used by one or more pivot tables. It contains
2679
+ * field definitions, shared item pools, and optionally the full set of cached records.
2680
+ *
2681
+ * @group PivotTables
2682
+ */
2683
+ type PivotCache = PivotCacheWorksheet | PivotCacheExternal | PivotCacheConsolidation | PivotCacheScenario;
2684
+
2685
+ /**
2686
+ * A calculated field definition in a pivot table. Calculated fields derive their values from a
2687
+ * formula that references other cache fields.
2688
+ *
2689
+ * @group PivotTables
2690
+ */
2691
+ type PivotCalculatedField = {
2692
+ /** The name of the calculated field. */
2693
+ name: string;
2694
+ /** The formula expression that computes this field's values from other cache fields. */
2695
+ formula: string;
2696
+ };
2697
+
2698
+ /**
2699
+ * The aggregation function applied to a data field's values.
2700
+ *
2701
+ * Beware of the `'count'` false cognate: here it means "count of non-empty values" (like the
2702
+ * COUNTA worksheet function), while in {@link PivotSubtotalFunction} `'count'` means "count of
2703
+ * numeric values" (like the COUNT worksheet function). The `'countNums'` value here corresponds
2704
+ * to COUNT.
2705
+ *
2706
+ * @group PivotTables
2707
+ */
2708
+ type PivotDataFieldAggregation = 'sum' | 'count' | 'average' | 'max' | 'min' | 'product' | 'countNums' | 'stdDev' | 'stdDevP' | 'var' | 'varP';
2709
+
2710
+ /**
2711
+ * Controls how a data field's values are displayed relative to other values. For example,
2712
+ * `'percentOfTotal'` displays each value as a percentage of the grand total.
2713
+ *
2714
+ * @group PivotTables
2715
+ */
2716
+ type PivotShowDataAs = 'normal' | 'difference' | 'percent' | 'percentDiff' | 'runTotal' | 'percentOfRow' | 'percentOfCol' | 'percentOfTotal' | 'index' | 'percentOfParentRow' | 'percentOfParentCol' | 'percentOfParent' | 'percentOfRunningTotal' | 'rankAscending' | 'rankDescending';
2717
+
2718
+ /**
2719
+ * Describes a data field in a pivot table. Data fields define the values that are aggregated and
2720
+ * displayed in the data area of the pivot table.
2721
+ *
2722
+ * @group PivotTables
2723
+ */
2724
+ type PivotDataField = {
2725
+ /**
2726
+ * The display name of the data field (e.g. "Sum of Revenue"). Derivable from the field name
2727
+ * and aggregation function, but Excel always writes it.
2728
+ */
2729
+ name?: string;
2730
+ /** Index into the pivot table's {@link PivotField} array (and the cache's field array). */
2731
+ fieldIndex: integer;
2732
+ /**
2733
+ * The aggregation function to apply (NB: not related to row/column subtotals configured
2734
+ * via {@link PivotField.subtotalFunctions}).
2735
+ *
2736
+ * @default 'sum'
2737
+ */
2738
+ subtotal?: PivotDataFieldAggregation;
2739
+ /**
2740
+ * How to display the aggregated values.
2741
+ *
2742
+ * @default 'normal'
2743
+ */
2744
+ showDataAs?: PivotShowDataAs;
2745
+ /**
2746
+ * The index of the base field used for "show data as" calculations (e.g. percent difference).
2747
+ * Only meaningful when {@link showDataAs} is set to a relative calculation mode.
2748
+ *
2749
+ * @default -1
2750
+ */
2751
+ baseField?: integer;
2752
+ /**
2753
+ * The index of the base item used for "show data as" calculations. Only meaningful when
2754
+ * {@link showDataAs} is set to a relative calculation mode.
2755
+ *
2756
+ * @default 1048832
2757
+ */
2758
+ baseItem?: integer;
2759
+ /** The number format code for this data field's values (e.g. `"General"`, `"#,##0"`). */
2760
+ numFmt?: string;
2761
+ };
2762
+
2763
+ /**
2764
+ * The subtotal aggregation functions that can be applied to a pivot field.
2765
+ *
2766
+ * Beware of the `'count'` false cognate: here it means "count of numeric values" (like the COUNT
2767
+ * worksheet function), while in {@link PivotDataFieldAggregation} `'count'` means "count of
2768
+ * non-empty values" (like the COUNTA worksheet function).
2769
+ *
2770
+ * @group PivotTables
2771
+ */
2772
+ type PivotSubtotalFunction = 'sum' | 'countA' | 'avg' | 'max' | 'min' | 'product' | 'count' | 'stdDev' | 'stdDevP' | 'var' | 'varP';
2773
+
2774
+ /**
2775
+ * The type of a pivot field item, indicating its role in the pivot table layout.
2776
+ *
2777
+ * - `'data'` — a regular data item representing a unique value from the field.
2778
+ * - `'default'` — the default subtotal item.
2779
+ * - Any {@link PivotSubtotalFunction} value — a specific subtotal aggregation item.
2780
+ * - `'grand'` — a grand total item.
2781
+ * - `'blank'` — a blank item (placeholder).
2782
+ *
2783
+ * @group PivotTables
2784
+ */
2785
+ type PivotItemType = PivotSubtotalFunction | 'data' | 'default' | 'grand' | 'blank';
2786
+
2787
+ /**
2788
+ * An item within a pivot field. Items represent individual values, subtotals, or other special
2789
+ * entries in a row or column field.
2790
+ *
2791
+ * @group PivotTables
2792
+ */
2793
+ type PivotFieldItem = {
2794
+ /**
2795
+ * Index into the corresponding cache field's {@link PivotCacheField.sharedItems | sharedItems}
2796
+ * array. Absent for non-data items (subtotals, grand totals, blanks).
2797
+ */
2798
+ itemIndex?: integer;
2799
+ /**
2800
+ * The type of this item.
2801
+ *
2802
+ * @default 'data'
2803
+ */
2804
+ itemType?: PivotItemType;
2805
+ /**
2806
+ * Whether this item is hidden (filtered out).
2807
+ *
2808
+ * @default false
2809
+ */
2810
+ hidden?: boolean;
2811
+ /**
2812
+ * Display name override for this item. When absent, the item's name is
2813
+ * derived from the cache field's shared items.
2814
+ */
2815
+ name?: string;
2816
+ /**
2817
+ * Whether this item's children are expanded (visible).
2818
+ *
2819
+ * @default true
2820
+ */
2821
+ expanded?: boolean;
2822
+ /**
2823
+ * Whether this item refers to a value that is no longer in the source data (a "missing" item).
2824
+ *
2825
+ * @default false
2826
+ */
2827
+ missing?: boolean;
2828
+ };
2829
+
2830
+ /**
2831
+ * Configuration for a single field in a pivot table. There is one PivotField per cache field, in
2832
+ * the same order as the cache fields.
2833
+ *
2834
+ * @group PivotTables
2835
+ */
2836
+ type PivotField = {
2837
+ /**
2838
+ * Display name override for this field. When present, this replaces
2839
+ * the cache field name in the pivot table's UI. Distinct from {@link PivotFieldItem.name} which
2840
+ * overrides individual item labels.
2841
+ */
2842
+ name?: string;
2843
+ /**
2844
+ * Which axis this field is placed on. Absent if the field is not placed on a row, column, or
2845
+ * page axis (e.g. fields used only as data fields, or fields not used in the layout at all).
2846
+ */
2847
+ axis?: PivotFieldAxis;
2848
+ /**
2849
+ * Whether this field is used as a data field. Data fields appear in the pivot table's
2850
+ * {@link PivotDataField} list; this flag indicates
2851
+ * that the field participates as a value source rather than being placed on a row/col/page axis.
2852
+ *
2853
+ * @default false
2854
+ */
2855
+ dataField?: boolean;
2856
+ /**
2857
+ * Whether to show all items for this field, including those with no data.
2858
+ *
2859
+ * @default true
2860
+ */
2861
+ showAll?: boolean;
2862
+ /**
2863
+ * The subtotal functions to show. When absent or empty, the default subtotal (typically sum or
2864
+ * count) is used.
2865
+ */
2866
+ subtotalFunctions?: PivotSubtotalFunction[];
2867
+ /**
2868
+ * The sort order for this field's items.
2869
+ *
2870
+ * @default 'manual'
2871
+ */
2872
+ sortType?: 'manual' | 'ascending' | 'descending';
2873
+ /** The items in this field, representing unique values and special entries. */
2874
+ items?: PivotFieldItem[];
2875
+ /**
2876
+ * Whether the field uses compact layout (labels in the same column as child fields).
2877
+ *
2878
+ * @default true
2879
+ */
2880
+ compact?: boolean;
2881
+ /**
2882
+ * Whether the field uses outline layout (labels on their own row, above child data).
2883
+ *
2884
+ * @default true
2885
+ */
2886
+ outline?: boolean;
2887
+ /**
2888
+ * Whether subtotals appear at the top of each group (only meaningful in outline mode).
2889
+ *
2890
+ * @default true
2891
+ */
2892
+ subtotalTop?: boolean;
2893
+ /**
2894
+ * Whether to insert a blank row after each group in this field.
2895
+ *
2896
+ * @default false
2897
+ */
2898
+ insertBlankRow?: boolean;
2899
+ /**
2900
+ * Whether to show the default subtotal for this field.
2901
+ *
2902
+ * @default true
2903
+ */
2904
+ defaultSubtotal?: boolean;
2905
+ /** Custom caption for the subtotal row. */
2906
+ subtotalCaption?: string;
2907
+ /** The number format code for this field's data (e.g. `"General"`, `"#,##0"`). */
2908
+ numFmt?: string;
2909
+ /**
2910
+ * Whether filter dropdowns are shown for this field.
2911
+ *
2912
+ * @default true
2913
+ */
2914
+ showDropDowns?: boolean;
2915
+ /**
2916
+ * Whether the field can be dragged to the row axis.
2917
+ *
2918
+ * @default true
2919
+ */
2920
+ dragToRow?: boolean;
2921
+ /**
2922
+ * Whether the field can be dragged to the column axis.
2923
+ *
2924
+ * @default true
2925
+ */
2926
+ dragToCol?: boolean;
2927
+ /**
2928
+ * Whether the field can be dragged to the page (filter) axis.
2929
+ *
2930
+ * @default true
2931
+ */
2932
+ dragToPage?: boolean;
2933
+ /**
2934
+ * Whether the field can be dragged to the data area.
2935
+ *
2936
+ * @default true
2937
+ */
2938
+ dragToData?: boolean;
2939
+ /**
2940
+ * Whether the field can be dragged off the pivot table (removed).
2941
+ *
2942
+ * @default true
2943
+ */
2944
+ dragOff?: boolean;
2945
+ /**
2946
+ * Whether multiple items can be selected in this field's filter.
2947
+ *
2948
+ * @default false
2949
+ */
2950
+ multipleItemSelectionAllowed?: boolean;
2951
+ /**
2952
+ * Whether a page break is inserted after each group in this field.
2953
+ *
2954
+ * @default false
2955
+ */
2956
+ insertPageBreak?: boolean;
2957
+ /**
2958
+ * Whether newly added items are hidden by default.
2959
+ *
2960
+ * @default false
2961
+ */
2962
+ hideNewItems?: boolean;
2963
+ /**
2964
+ * Whether new items are included in the field's manual filter.
2965
+ *
2966
+ * @default false
2967
+ */
2968
+ includeNewItemsInFilter?: boolean;
2969
+ /**
2970
+ * Whether the auto-show (top/bottom N) filter is enabled.
2971
+ *
2972
+ * @default false
2973
+ */
2974
+ autoShow?: boolean;
2975
+ /**
2976
+ * Whether auto-show displays the top N items (true) or bottom N items (false).
2977
+ *
2978
+ * @default true
2979
+ */
2980
+ topAutoShow?: boolean;
2981
+ /**
2982
+ * Number of items to display when auto-show is enabled.
2983
+ *
2984
+ * @default 10
2985
+ */
2986
+ itemPageCount?: integer;
2987
+ /** Whether sorting is deferred to the data source. */
2988
+ dataSourceSort?: boolean;
2989
+ /**
2990
+ * Whether the field defaults to no auto-sort (manual sort).
2991
+ *
2992
+ * @default false
2993
+ */
2994
+ nonAutoSortDefault?: boolean;
2995
+ /** Index of the data field used for ranking. */
2996
+ rankBy?: integer;
2997
+ /**
2998
+ * Whether this field's hierarchy level is hidden.
2999
+ *
3000
+ * @default false
3001
+ */
3002
+ hiddenLevel?: boolean;
3003
+ /** The unique member property for this field (OLAP). */
3004
+ uniqueMemberProperty?: string;
3005
+ /**
3006
+ * Whether all items in this field are drilled down.
3007
+ *
3008
+ * @default false
3009
+ */
3010
+ allDrilled?: boolean;
3011
+ /**
3012
+ * Whether this is a server-based field.
3013
+ *
3014
+ * @default false
3015
+ */
3016
+ serverField?: boolean;
3017
+ /**
3018
+ * Whether the field supports measure filtering (OLAP).
3019
+ *
3020
+ * @default false
3021
+ */
3022
+ measureFilter?: boolean;
3023
+ /**
3024
+ * Whether member property values are shown in cells.
3025
+ *
3026
+ * @default false
3027
+ */
3028
+ showPropCell?: boolean;
3029
+ /**
3030
+ * Whether member property values are shown in tooltips.
3031
+ *
3032
+ * @default false
3033
+ */
3034
+ showPropTip?: boolean;
3035
+ /**
3036
+ * Whether member property values are used as captions.
3037
+ *
3038
+ * @default false
3039
+ */
3040
+ showPropAsCaption?: boolean;
3041
+ /**
3042
+ * Default drill state for member properties.
3043
+ *
3044
+ * @default false
3045
+ */
3046
+ defaultAttributeDrillState?: boolean;
3047
+ };
3048
+
3049
+ /**
3050
+ * The type of a pivot table filter.
3051
+ *
3052
+ * @group PivotTables
3053
+ */
3054
+ type PivotFilterType = 'unknown' | 'count' | 'percent' | 'sum' | 'captionEqual' | 'captionNotEqual' | 'captionBeginsWith' | 'captionNotBeginsWith' | 'captionEndsWith' | 'captionNotEndsWith' | 'captionContains' | 'captionNotContains' | 'captionGreaterThan' | 'captionGreaterThanOrEqual' | 'captionLessThan' | 'captionLessThanOrEqual' | 'captionBetween' | 'captionNotBetween' | 'valueEqual' | 'valueNotEqual' | 'valueGreaterThan' | 'valueGreaterThanOrEqual' | 'valueLessThan' | 'valueLessThanOrEqual' | 'valueBetween' | 'valueNotBetween' | 'dateEqual' | 'dateNotEqual' | 'dateOlderThan' | 'dateOlderThanOrEqual' | 'dateNewerThan' | 'dateNewerThanOrEqual' | 'dateBetween' | 'dateNotBetween' | 'tomorrow' | 'today' | 'yesterday' | 'nextWeek' | 'thisWeek' | 'lastWeek' | 'nextMonth' | 'thisMonth' | 'lastMonth' | 'nextQuarter' | 'thisQuarter' | 'lastQuarter' | 'nextYear' | 'thisYear' | 'lastYear' | 'yearToDate' | 'Q1' | 'Q2' | 'Q3' | 'Q4' | 'M1' | 'M2' | 'M3' | 'M4' | 'M5' | 'M6' | 'M7' | 'M8' | 'M9' | 'M10' | 'M11' | 'M12';
3055
+
3056
+ /**
3057
+ * An advanced filter applied to a pivot table field.
3058
+ *
3059
+ * Pivot filters implement features like "Show Top 10", "Show items where value > X",
3060
+ * and date-based filters.
3061
+ *
3062
+ * @group PivotTables
3063
+ */
3064
+ type PivotFilter = {
3065
+ /** Index of the pivot field this filter applies to. */
3066
+ fieldIndex: integer;
3067
+ /** The filter type. */
3068
+ type: PivotFilterType;
3069
+ /** Unique identifier for this filter within the pivot table. */
3070
+ id: integer;
3071
+ /**
3072
+ * Evaluation order for multiple filters. Lower values are evaluated first.
3073
+ *
3074
+ * @default 0
3075
+ */
3076
+ evalOrder?: integer;
3077
+ /** Member property field index (OLAP). */
3078
+ mpFld?: integer;
3079
+ /** Measure hierarchy index (OLAP). */
3080
+ iMeasureHier?: integer;
3081
+ /** Measure field index used for value-based filters. */
3082
+ iMeasureFld?: integer;
3083
+ /** Display name for the filter. */
3084
+ name?: string;
3085
+ /** Description of the filter. */
3086
+ description?: string;
3087
+ /** First string value for comparison-based filters. */
3088
+ stringValue1?: string;
3089
+ /** Second string value for between/not-between filters. */
3090
+ stringValue2?: string;
3091
+ /** Auto-filter criteria that implement this pivot filter. */
3092
+ autoFilter?: {
3093
+ /** The reference range for the auto-filter. */
3094
+ ref?: string;
3095
+ /** Filter columns with their criteria. */
3096
+ filterColumns?: PivotAutoFilterColumn[];
3097
+ };
3098
+ };
3099
+
3100
+ /**
3101
+ * Describes a page (filter) field in a pivot table. Page fields allow the user to filter the
3102
+ * entire pivot table to show only data matching a selected item.
3103
+ *
3104
+ * @group PivotTables
3105
+ */
3106
+ type PivotPageField = {
3107
+ /** Index into the pivot table's {@link PivotField} array (and the cache's field array). */
3108
+ fieldIndex: integer;
3109
+ /**
3110
+ * The index of the currently selected item in the field's items list. When absent, all items are
3111
+ * shown (no filter applied).
3112
+ */
3113
+ selectedItem?: integer;
3114
+ /**
3115
+ * An optional name override for the page field. Identifies the field in formulas and
3116
+ * programmatic access (e.g. GETPIVOTDATA).
3117
+ */
3118
+ name?: string;
3119
+ /**
3120
+ * Display caption for the page field. Shown in the pivot table UI but not used for programmatic
3121
+ * field identification.
3122
+ */
3123
+ caption?: string;
3124
+ /**
3125
+ * Hierarchy index for OLAP page fields.
3126
+ *
3127
+ * @default -1
3128
+ */
3129
+ hierarchy?: integer;
3130
+ };
3131
+
3132
+ /**
3133
+ * A layout item in the row or column area, describing what each row or column header represents.
3134
+ *
3135
+ * @group PivotTables
3136
+ */
3137
+ type PivotRowColItem = {
3138
+ /**
3139
+ * The type of this layout item (same enumeration as {@link PivotFieldItem.itemType}).
3140
+ *
3141
+ * @default 'data'
3142
+ */
3143
+ itemType?: PivotItemType;
3144
+ /**
3145
+ * The number of leading axis positions whose {@link itemIndices} entries are omitted because
3146
+ * they are identical to the previous {@link PivotRowColItem}'s values (see
3147
+ * {@link PivotTable | PivotTable's type description} for the level/axis model). The omitted
3148
+ * entries are inherited from the preceding item in {@link PivotTable.rowItems | rowItems} or
3149
+ * {@link PivotTable.colItems | colItems}.
3150
+ *
3151
+ * @default 0
3152
+ */
3153
+ repeatedItemCount?: integer;
3154
+ /**
3155
+ * Indices into each axis field's {@link PivotField.items | items} array. Entries correspond
3156
+ * positionally to the fields listed in {@link PivotTable.rowFieldIndices | rowFieldIndices} (for
3157
+ * row items) or {@link PivotTable.colFieldIndices | colFieldIndices} (for column items): entry
3158
+ * *i* indexes into the *i*-th axis field's {@link PivotField.items | items}.
3159
+ *
3160
+ * When {@link repeatedItemCount} is greater than zero, the first that many entries are omitted
3161
+ * (inherited from the previous {@link PivotRowColItem}), so the array starts at position
3162
+ * {@link repeatedItemCount}.
3163
+ */
3164
+ itemIndices?: integer[];
3165
+ /**
3166
+ * Index into the pivot table's {@link PivotTable.dataFields | dataFields}, indicating which data
3167
+ * field this item represents.
3168
+ *
3169
+ * @default 0
3170
+ */
3171
+ dataFieldIndex?: integer;
3172
+ };
3173
+
3174
+ /**
3175
+ * Describes the position of the pivot table's header and data areas within its output range
3176
+ * ({@link PivotTable.ref | ref}).
3177
+ *
3178
+ * All offsets are 0-based from the top-left cell of {@link PivotTable.ref | ref}. The difference
3179
+ * `firstDataRow - firstHeaderRow` equals the number of column-field header rows.
3180
+ *
3181
+ * @group PivotTables
3182
+ */
3183
+ type PivotTableLocation = {
3184
+ /**
3185
+ * 0-based row offset from the top of {@link PivotTable.ref | ref} to the first row of the body
3186
+ * area (column-field items, or data if there are no column fields).
3187
+ */
3188
+ firstHeaderRow: integer;
3189
+ /**
3190
+ * 0-based row offset from the top of {@link PivotTable.ref | ref} to the first row containing
3191
+ * data values.
3192
+ */
3193
+ firstDataRow: integer;
3194
+ /**
3195
+ * 0-based column offset from the left of {@link PivotTable.ref | ref} to the first column
3196
+ * containing data values.
3197
+ */
3198
+ firstDataCol: integer;
3199
+ /**
3200
+ * Number of rows occupied by the page field area (see {@link PivotTable | PivotTable's type
3201
+ * description}). Layout depends on {@link PivotTable.pageOverThenDown | pageOverThenDown} and
3202
+ * {@link PivotTable.pageWrap | pageWrap}.
3203
+ *
3204
+ * @default 0
3205
+ */
3206
+ rowPageCount?: integer;
3207
+ /**
3208
+ * Number of columns occupied by the page field area (see {@link PivotTable | PivotTable's type
3209
+ * description}). Layout depends on {@link PivotTable.pageOverThenDown | pageOverThenDown} and
3210
+ * {@link PivotTable.pageWrap | pageWrap}.
3211
+ *
3212
+ * @default 0
3213
+ */
3214
+ colPageCount?: integer;
3215
+ };
3216
+
3217
+ /**
3218
+ * Excel's built-in pivot table style names.
3219
+ *
3220
+ * @group PivotTables
3221
+ */
3222
+ type PivotTableStyleName = 'PivotStyleDark1' | 'PivotStyleDark2' | 'PivotStyleDark3' | 'PivotStyleDark4' | 'PivotStyleDark5' | 'PivotStyleDark6' | 'PivotStyleDark7' | 'PivotStyleDark8' | 'PivotStyleDark9' | 'PivotStyleDark10' | 'PivotStyleDark11' | 'PivotStyleDark12' | 'PivotStyleDark13' | 'PivotStyleDark14' | 'PivotStyleDark15' | 'PivotStyleDark16' | 'PivotStyleDark17' | 'PivotStyleDark18' | 'PivotStyleDark19' | 'PivotStyleDark20' | 'PivotStyleDark21' | 'PivotStyleDark22' | 'PivotStyleDark23' | 'PivotStyleDark24' | 'PivotStyleDark25' | 'PivotStyleDark26' | 'PivotStyleDark27' | 'PivotStyleDark28' | 'PivotStyleLight1' | 'PivotStyleLight2' | 'PivotStyleLight3' | 'PivotStyleLight4' | 'PivotStyleLight5' | 'PivotStyleLight6' | 'PivotStyleLight7' | 'PivotStyleLight8' | 'PivotStyleLight9' | 'PivotStyleLight10' | 'PivotStyleLight11' | 'PivotStyleLight12' | 'PivotStyleLight13' | 'PivotStyleLight14' | 'PivotStyleLight15' | 'PivotStyleLight16' | 'PivotStyleLight17' | 'PivotStyleLight18' | 'PivotStyleLight19' | 'PivotStyleLight20' | 'PivotStyleLight21' | 'PivotStyleLight22' | 'PivotStyleLight23' | 'PivotStyleLight24' | 'PivotStyleLight25' | 'PivotStyleLight26' | 'PivotStyleLight27' | 'PivotStyleLight28' | 'PivotStyleMedium1' | 'PivotStyleMedium2' | 'PivotStyleMedium3' | 'PivotStyleMedium4' | 'PivotStyleMedium5' | 'PivotStyleMedium6' | 'PivotStyleMedium7' | 'PivotStyleMedium8' | 'PivotStyleMedium9' | 'PivotStyleMedium10' | 'PivotStyleMedium11' | 'PivotStyleMedium12' | 'PivotStyleMedium13' | 'PivotStyleMedium14' | 'PivotStyleMedium15' | 'PivotStyleMedium16' | 'PivotStyleMedium17' | 'PivotStyleMedium18' | 'PivotStyleMedium19' | 'PivotStyleMedium20' | 'PivotStyleMedium21' | 'PivotStyleMedium22' | 'PivotStyleMedium23' | 'PivotStyleMedium24' | 'PivotStyleMedium25' | 'PivotStyleMedium26' | 'PivotStyleMedium27' | 'PivotStyleMedium28';
3223
+
3224
+ /**
3225
+ * Presentation style settings for a pivot table.
3226
+ *
3227
+ * @group PivotTables
3228
+ */
3229
+ type PivotTableStyle = {
3230
+ /**
3231
+ * The name of the pivot table style (e.g. `"PivotStyleMedium9"`).
3232
+ *
3233
+ * If the value is null or omitted the table should not be rendered with any special styling (note
3234
+ * that this only applies if the style object itself is present).
3235
+ *
3236
+ * @default null
3237
+ */
3238
+ name?: PivotTableStyleName | null;
3239
+ /**
3240
+ * Whether row header formatting should be applied.
3241
+ *
3242
+ * @default false
3243
+ */
3244
+ showRowHeaders?: boolean;
3245
+ /**
3246
+ * Whether column header formatting should be applied.
3247
+ *
3248
+ * @default false
3249
+ */
3250
+ showColumnHeaders?: boolean;
3251
+ /**
3252
+ * Whether row stripe formatting should be applied.
3253
+ *
3254
+ * @default false
3255
+ */
3256
+ showRowStripes?: boolean;
3257
+ /**
3258
+ * Whether column stripe formatting should be applied.
3259
+ *
3260
+ * @default false
3261
+ */
3262
+ showColumnStripes?: boolean;
3263
+ /**
3264
+ * Whether the last column's formatting from the named style is applied to the grand total column.
3265
+ *
3266
+ * @default false
3267
+ */
3268
+ showLastColumn?: boolean;
3269
+ };
3270
+
3271
+ /**
3272
+ * A pivot table definition. Pivot tables dynamically group, filter, and aggregate source data,
3273
+ * displaying the results in a structured layout on a worksheet.
3274
+ *
3275
+ * The layout is organized around **axes**: each {@link PivotField} can be placed on the row axis,
3276
+ * column axis, or page (filter) axis via its {@link PivotField.axis | axis} property.
3277
+ * {@link rowFieldIndices} and {@link colFieldIndices} list the fields on each axis in display
3278
+ * order; each position in that list is sometimes called a **level**. The page axis fields appear
3279
+ * in the **page field area**, a region above the pivot table body where filter dropdowns are
3280
+ * displayed (see {@link pageFields}).
3281
+ *
3282
+ * {@link rowItems} and {@link colItems} describe the rendered layout: each
3283
+ * {@link PivotRowColItem} represents one row or column header, with
3284
+ * {@link PivotRowColItem.itemIndices | itemIndices} mapping positionally to the fields on that
3285
+ * axis. The **data area** is the grid of aggregated values framed by those row and column
3286
+ * headers; its contents are defined by the {@link dataFields}.
3287
+ *
3288
+ * ```
3289
+ * +--------------------------------------------+
3290
+ * | Page field area (filters) | pageFields
3291
+ * | rowPageCount × colPageCount |
3292
+ * +----------------+---------------------------+ firstHeaderRow
3293
+ * | | Column headers | colItems
3294
+ * | Row headers +---------------------------+ firstDataRow
3295
+ * | (rowItems) | Data area |
3296
+ * | | (dataFields) |
3297
+ * +----------------+---------------------------+
3298
+ * ^ firstDataCol
3299
+ * ```
3300
+ *
3301
+ * {@link PivotTableLocation.firstHeaderRow | firstHeaderRow},
3302
+ * {@link PivotTableLocation.firstDataRow | firstDataRow}, and
3303
+ * {@link PivotTableLocation.firstDataCol | firstDataCol} locate these regions within the
3304
+ * output range ({@link ref}).
3305
+ *
3306
+ * @see {@link https://support.microsoft.com/office/a9a84538-bfe9-40a9-a8e9-f99134456576}
3307
+ *
3308
+ * @group PivotTables
3309
+ */
3310
+ type PivotTable = {
3311
+ /**
3312
+ * The name of the pivot table. Typically unique per workbook, but Excel allows duplicate names
3313
+ * across different sheets.
3314
+ */
3315
+ name: string;
3316
+ /** The name of the sheet where this pivot table's output is rendered. */
3317
+ sheet: string;
3318
+ /** The pivot cache that supplies source data for this pivot table. */
3319
+ cache: PivotCache;
3320
+ /** The A1-style range reference covering the pivot table's output area. */
3321
+ ref: CellRange;
3322
+ /** Position information for the pivot table's data within its output range. */
3323
+ location: PivotTableLocation;
3324
+ /**
3325
+ * The pivot fields, paralleling the cache's {@link PivotCacheBase.fields | fields} array.
3326
+ * Each field's configuration determines whether and how it participates in the pivot table
3327
+ * layout.
3328
+ */
3329
+ fields: PivotField[];
3330
+ /**
3331
+ * Indices into {@link fields} identifying which fields appear on the row axis, in display order.
3332
+ * Negative indices are special placeholders (e.g. `-2` represents the "Values" virtual field,
3333
+ * used when there are multiple data fields) and do not index into {@link fields}.
3334
+ */
3335
+ rowFieldIndices?: integer[];
3336
+ /**
3337
+ * Indices into {@link fields} identifying which fields appear on the column axis, in display
3338
+ * order. Negative indices are special placeholders (e.g. `-2` represents the "Values" virtual
3339
+ * field) and do not index into {@link fields}.
3340
+ */
3341
+ colFieldIndices?: integer[];
3342
+ /** The data fields, defining the aggregated values displayed in the pivot table's data area. */
3343
+ dataFields?: PivotDataField[];
3344
+ /** The page (filter) fields, allowing the pivot table to be filtered by specific field values. */
3345
+ pageFields?: PivotPageField[];
3346
+ /** Layout items for the row area, describing each row header. */
3347
+ rowItems?: PivotRowColItem[];
3348
+ /** Layout items for the column area, describing each column header. */
3349
+ colItems?: PivotRowColItem[];
3350
+ /** Presentation style for the pivot table. */
3351
+ style?: PivotTableStyle;
3352
+ /** Advanced filters applied to pivot fields. */
3353
+ filters?: PivotFilter[];
3354
+ /**
3355
+ * Calculated field definitions. Each entry defines a formula-based field that derives its values
3356
+ * from other cache fields.
3357
+ */
3358
+ calculatedFields?: PivotCalculatedField[];
3359
+ /**
3360
+ * Revision-tracking unique identifier. A GUID string like
3361
+ * `"{93AACE53-8F3A-A04A-893A-A439866B3165}"` assigned by Excel 2014+ for revision tracking.
3362
+ */
3363
+ uid?: string;
3364
+ /**
3365
+ * Whether grand totals should be shown for rows.
3366
+ *
3367
+ * @default true
3368
+ */
3369
+ rowGrandTotals?: boolean;
3370
+ /**
3371
+ * Whether grand totals should be shown for columns.
3372
+ *
3373
+ * @default true
3374
+ */
3375
+ colGrandTotals?: boolean;
3376
+ /**
3377
+ * Whether the pivot table should automatically refresh when its source data changes.
3378
+ *
3379
+ * @default false
3380
+ */
3381
+ autoRefresh?: boolean;
3382
+ /**
3383
+ * Default compact flag for pivot fields. Fields inherit this unless they override
3384
+ * {@link PivotField.compact | their own compact}.
3385
+ *
3386
+ * @default true
3387
+ */
3388
+ compact?: boolean;
3389
+ /**
3390
+ * Default outline flag for pivot fields. Fields inherit this unless they override
3391
+ * {@link PivotField.outline | their own outline}.
3392
+ *
3393
+ * @default false
3394
+ */
3395
+ outline?: boolean;
3396
+ /**
3397
+ * Whether data-area values are repeated on outline header rows. When false (the default),
3398
+ * values appear only on the innermost detail rows; when true, each outline-level header row
3399
+ * also shows the aggregated values for its group.
3400
+ *
3401
+ * @default false
3402
+ */
3403
+ outlineData?: boolean;
3404
+ /**
3405
+ * Whether data fields in compact layout share a single column.
3406
+ *
3407
+ * @default true
3408
+ */
3409
+ compactData?: boolean;
3410
+ /**
3411
+ * Whether classic-style grid drop zones are shown. Drop zones are labeled regions (e.g.
3412
+ * "Drop Row Fields Here") displayed in the pivot table area where fields can be dragged to
3413
+ * assign them to an axis.
3414
+ *
3415
+ * @default false
3416
+ */
3417
+ gridDropZones?: boolean;
3418
+ /**
3419
+ * Number of character widths to indent row labels in compact layout.
3420
+ *
3421
+ * @default 1
3422
+ */
3423
+ indent?: integer;
3424
+ /**
3425
+ * Whether the data (values) axis runs along rows rather than columns.
3426
+ *
3427
+ * @default false
3428
+ */
3429
+ dataOnRows?: boolean;
3430
+ /**
3431
+ * Position of the "Values" virtual field within its axis. When absent, the Values field is placed
3432
+ * at the end.
3433
+ */
3434
+ dataPosition?: integer;
3435
+ /**
3436
+ * Whether row and column headers are displayed.
3437
+ *
3438
+ * @default true
3439
+ */
3440
+ showHeaders?: boolean;
3441
+ /**
3442
+ * Whether empty rows are shown in the output.
3443
+ *
3444
+ * @default false
3445
+ */
3446
+ showEmptyRow?: boolean;
3447
+ /**
3448
+ * Whether empty columns are shown in the output.
3449
+ *
3450
+ * @default false
3451
+ */
3452
+ showEmptyCol?: boolean;
3453
+ /**
3454
+ * Whether drop zones for fields are displayed in the pivot table area.
3455
+ *
3456
+ * @default true
3457
+ */
3458
+ showDropZones?: boolean;
3459
+ /**
3460
+ * Whether member property tooltips are shown.
3461
+ *
3462
+ * @default true
3463
+ */
3464
+ showMemberPropertyTips?: boolean;
3465
+ /**
3466
+ * Whether drill-down (expand/collapse) is enabled on pivot field items.
3467
+ *
3468
+ * @default true
3469
+ */
3470
+ enableDrill?: boolean;
3471
+ /**
3472
+ * Whether the pivot table shows "Multiple Items" labels when a page field
3473
+ * has more than one item selected.
3474
+ *
3475
+ * @default true
3476
+ */
3477
+ showMultipleLabel?: boolean;
3478
+ /**
3479
+ * Caption for the data (values) area. Excel always writes this (typically `"Data"` or a
3480
+ * localized equivalent).
3481
+ */
3482
+ dataCaption?: string;
3483
+ /** Custom label for grand total rows/columns. */
3484
+ grandTotalCaption?: string;
3485
+ /** Text to display in place of error values. */
3486
+ errorCaption?: string;
3487
+ /**
3488
+ * Whether error captions are shown (when true, cells with errors display {@link errorCaption}).
3489
+ *
3490
+ * @default false
3491
+ */
3492
+ showError?: boolean;
3493
+ /** Text to display in place of missing values. */
3494
+ missingCaption?: string;
3495
+ /**
3496
+ * Whether missing-value captions are shown.
3497
+ *
3498
+ * @default true
3499
+ */
3500
+ showMissing?: boolean;
3501
+ /** Caption for the row header area. */
3502
+ rowHeaderCaption?: string;
3503
+ /** Caption for the column header area. */
3504
+ colHeaderCaption?: string;
3505
+ /**
3506
+ * Whether hidden items are included in subtotals.
3507
+ *
3508
+ * @default false
3509
+ */
3510
+ subtotalHiddenItems?: boolean;
3511
+ /**
3512
+ * Whether field names are printed on each page when the pivot table is printed.
3513
+ *
3514
+ * @default false
3515
+ */
3516
+ fieldPrintTitles?: boolean;
3517
+ /**
3518
+ * Whether item labels are printed on each page when the pivot table is printed.
3519
+ *
3520
+ * @default false
3521
+ */
3522
+ itemPrintTitles?: boolean;
3523
+ /**
3524
+ * Whether labels from outer row fields are merged across cells.
3525
+ *
3526
+ * @default false
3527
+ */
3528
+ mergeItem?: boolean;
3529
+ /**
3530
+ * Whether custom list ordering is used when sorting items.
3531
+ *
3532
+ * @default true
3533
+ */
3534
+ customListSort?: boolean;
3535
+ /**
3536
+ * Whether multiple filters can be applied to a single field simultaneously.
3537
+ *
3538
+ * @default true
3539
+ */
3540
+ multipleFieldFilters?: boolean;
3541
+ /**
3542
+ * Whether field items are shown in the pivot table body.
3543
+ *
3544
+ * @default true
3545
+ */
3546
+ showItems?: boolean;
3547
+ /**
3548
+ * Whether calculated members from OLAP data sources are shown.
3549
+ *
3550
+ * @default true
3551
+ */
3552
+ showCalcMbrs?: boolean;
3553
+ /**
3554
+ * Whether cell formatting is preserved on refresh.
3555
+ *
3556
+ * @default true
3557
+ */
3558
+ preserveFormatting?: boolean;
3559
+ /**
3560
+ * Number of page fields per column before wrapping to a new column.
3561
+ *
3562
+ * @default 0
3563
+ */
3564
+ pageWrap?: integer;
3565
+ /**
3566
+ * Whether page fields are laid out across then down (true) or down then across (false).
3567
+ *
3568
+ * @default false
3569
+ */
3570
+ pageOverThenDown?: boolean;
3571
+ /** Built-in auto-format ID. */
3572
+ autoFormatId?: integer;
3573
+ /**
3574
+ * Whether auto-formatting is applied.
3575
+ *
3576
+ * @default false
3577
+ */
3578
+ useAutoFormatting?: boolean;
3579
+ /**
3580
+ * Whether number formats from the auto-format are applied.
3581
+ *
3582
+ * @default false
3583
+ */
3584
+ applyNumberFormats?: boolean;
3585
+ /**
3586
+ * Whether border formats from the auto-format are applied.
3587
+ *
3588
+ * @default false
3589
+ */
3590
+ applyBorderFormats?: boolean;
3591
+ /**
3592
+ * Whether font formats from the auto-format are applied.
3593
+ *
3594
+ * @default false
3595
+ */
3596
+ applyFontFormats?: boolean;
3597
+ /**
3598
+ * Whether pattern (fill) formats from the auto-format are applied.
3599
+ *
3600
+ * @default false
3601
+ */
3602
+ applyPatternFormats?: boolean;
3603
+ /**
3604
+ * Whether alignment formats from the auto-format are applied.
3605
+ *
3606
+ * @default false
3607
+ */
3608
+ applyAlignmentFormats?: boolean;
3609
+ /**
3610
+ * Whether width/height adjustments from the auto-format are applied.
3611
+ *
3612
+ * @default false
3613
+ */
3614
+ applyWidthHeightFormats?: boolean;
3615
+ };
3616
+
3617
+ /**
3618
+ * Directions on how formulas should be recalculated in the workbook.
3619
+ *
3620
+ * @group Workbooks
3621
+ */
3622
+ type CalcProps = {
3623
+ /**
3624
+ * Specifies whether an attempt should be made to calculate formulas that contain circular
3625
+ * references. Defaults to `false` in Excel.
3626
+ */
3627
+ iterate?: boolean;
3628
+ /**
3629
+ * The maximum number of calculation iterations, when {@link CalcProps.iterate} is `true`.
3630
+ * Defaults to `100` in Excel.
3631
+ */
3632
+ iterateCount?: integer;
3633
+ /**
3634
+ * When a calculation iteration results in an absolute change that is less than iterateDelta,
3635
+ * then no further iterations should be attempted. Defaults to `0.001` in Excel.
3636
+ */
3637
+ iterateDelta?: number;
3638
+ /**
3639
+ * Which of the two date systems the workbook uses. 1900 is the default.
3640
+ *
3641
+ * @see {@link https://support.microsoft.com/office/e7fe7167-48a9-4b96-bb53-5612a800b487 | Date systems in Excel}
3642
+ */
3643
+ epoch?: 1900 | 1904;
3644
+ /**
3645
+ * The calculation mode for the workbook.
3646
+ *
3647
+ * - `"auto"` (default when absent): recalculate all formulas automatically.
3648
+ * - `"autoNoTable"`: recalculate automatically but exclude data tables.
3649
+ * - `"manual"`: formulas are only recalculated when explicitly triggered.
3650
+ *
3651
+ * @defaultValue "auto"
3652
+ */
3653
+ calcMode?: 'auto' | 'autoNoTable' | 'manual';
3654
+ };
3655
+
3656
+ /**
3657
+ * A collection of default properties that apply to cells, rows, or columns in the worksheet.
3658
+ *
3659
+ * @group Workbooks
3660
+ */
3661
+ type WorksheetDefaults = {
3662
+ /** Default width of the UI-grid column. */
3663
+ colWidth: PixelValue;
3664
+ /** Default height of the UI-grid height. */
3665
+ rowHeight: PixelValue;
3666
+ };
3667
+
3668
+ /**
3669
+ * Visual scale (aka zoom level, aka magnification) applied when displaying a worksheet.
3670
+ *
3671
+ * Each of the three layouts has its own scale. A scale is represented as a percentage, with `100`
3672
+ * (100%) being the default 1:1 scale. When a layout has no explicit scale, use 100%.
3673
+ *
3674
+ * @group Workbooks
3675
+ */
3676
+ type WorksheetLayoutScales = {
3677
+ /**
3678
+ * Zoom level for normal view.
3679
+ *
3680
+ * @min 10
3681
+ * @max 400
3682
+ * @defaultValue 100
3683
+ * */
3684
+ normal?: integer;
3685
+ /**
3686
+ * Zoom level for page layout view.
3687
+ *
3688
+ * @min 10
3689
+ * @max 400
3690
+ * @defaultValue 100
3691
+ */
3692
+ pageLayout?: integer;
3693
+ /**
3694
+ * Zoom level for page break preview (aka sheet layout view).
3695
+ *
3696
+ * @min 10
3697
+ * @max 400
3698
+ * @defaultValue 100
3699
+ */
3700
+ pageBreakPreview?: integer;
3701
+ };
3702
+
3703
+ /**
3704
+ * A worksheet view.
3705
+ *
3706
+ * A worksheet view is a display configuration for a particular worksheet. Worksheet view settings
3707
+ * can include:
3708
+ *
3709
+ * - Active cell
3710
+ * - Selected ranges
3711
+ * - View type (normal, page layout, or page break layout)
3712
+ * - Zoom level
3713
+ *
3714
+ * Currently JSF does not include all available settings for a worksheet.
3715
+ *
3716
+ * @group Workbooks
3717
+ */
3718
+ type WorksheetView = {
3719
+ /**
3720
+ * The id of the workbook view this worksheet view belongs to.
3721
+ *
3722
+ * This is a zero-based index of the workbook view, as stored in the {@link Workbook.views} array.
3723
+ *
3724
+ * Within a single worksheet, each view must reference a distinct workbook view (i.e. no two views
3725
+ * in the same worksheet can share the same `workbookView` id). However, views from different
3726
+ * worksheets may reference the same workbook view.
3727
+ */
3728
+ workbookView: integer;
3729
+ /** Cell that is selected by default when the sheet is visible. */
3730
+ activeCell?: CellId;
3731
+ /** Ranges of cells that are selected by default when the sheet is visible. */
3732
+ activeRanges?: CellRange[];
3733
+ /**
3734
+ * The layout used to display the worksheet.
3735
+ *
3736
+ * @defaultValue "normal"
3737
+ */
3738
+ activeLayout?: 'normal' | 'pageLayout' | 'pageBreakPreview';
3739
+ /**
3740
+ * Scale (aka zoom level, aka magnification) applied when displaying a worksheet. Each different
3741
+ * layout has its own scale.
3742
+ */
3743
+ layoutScales?: WorksheetLayoutScales;
3744
+ };
1928
3745
 
1929
3746
  /**
1930
3747
  * A rectangle of cells. A sheet within a spreadsheet.
3748
+ *
3749
+ * @group Workbooks
1931
3750
  */
1932
3751
  type Worksheet = {
1933
3752
  /** Name of the worksheet. */
@@ -1974,6 +3793,8 @@ type Worksheet = {
1974
3793
  * - Scroll bar visibility
1975
3794
  *
1976
3795
  * Currently JSF does not include all available settings for a workbook.
3796
+ *
3797
+ * @group Workbooks
1977
3798
  */
1978
3799
  type WorkbookView = {
1979
3800
  /**
@@ -1987,6 +3808,8 @@ type WorkbookView = {
1987
3808
  /**
1988
3809
  * A workbook is a collection of worksheets, styles, defined names, and other metadata. It's what's
1989
3810
  * commonly known as a spreadsheet.
3811
+ *
3812
+ * @group Workbooks
1990
3813
  */
1991
3814
  type Workbook = {
1992
3815
  /** Name of the workbook. In the case of a .xlsx file it will be the filename. */
@@ -1997,6 +3820,8 @@ type Workbook = {
1997
3820
  names?: DefinedName[];
1998
3821
  /** Metadata on the workbook's tables. */
1999
3822
  tables?: Table[];
3823
+ /** Metadata on the workbook's pivot tables. */
3824
+ pivotTables?: PivotTable[];
2000
3825
  /** Directions on how formulas should be recalculated in the workbook. */
2001
3826
  calculationProperties?: CalcProps;
2002
3827
  /** Styles for cells in the workbook. */
@@ -2044,4 +3869,4 @@ type Workbook = {
2044
3869
  images?: Record<string, string>;
2045
3870
  };
2046
3871
 
2047
- export type { AdjustCoordinate, AdjustPoint, AdjustValueHandlePolar, AdjustValueHandleXY, ArcToCommand, BlackWhiteMode, BlipFill, BorderStyle, CalcProps, Cell, CellId, CellOffset, CellRange, CellValueType, CloseCommand, Color, Comment, ConnectionPoint, CubicBezierToCommand, DashStop, DataTable, DefinedName, DmlAngle, Drawing, EmuValue, Extent, External, ExternalWorksheet, Fill, FillPatternStyle, FlipAxis, FontStyleIndex, GeomGuideName, GradientColorStop, GradientLinearFill, GradientPathFill, Graphic, GraphicAnchor, GraphicAnchorAbsolute, GraphicAnchorOneCell, GraphicAnchorTwoCell, GraphicBitmap, GraphicChart, GraphicConnectionShape, GraphicGroup, GraphicShape, GridSize, GroupFill, GuidePoint, HAlign, HyperlinkTextRun, InsetRect, Line, LineAlignment, LineCapType, LineCompoundType, LineEnd, LineEndSize, LineEndType, LineJoinType, LineStyle, LineToCommand, MentionTextRun, MoveToCommand, NoFill, Note, Paragraph, Path, PathCommand, PathFillMode, PathFillType, PatternFill, PatternStyle, Percentage, Person, PixelValue, Point, PositiveCoordinate, QuadraticBezierToCommand, RectAlignment, RelativeRect, Shape, ShapeRect, ShapeStyle, SolidFill, Style, Table, TableColumn, TableColumnDataType, TableStyle, TableStyleName, TextAnchoring, TextBody, TextHorzOverflow, TextRun, TextVertOverflow, TextVerticalType, TextWrapping, ThreadedComment, Tile, Underline, VAlign, Workbook, WorkbookView, Worksheet, WorksheetDefaults, WorksheetLayoutScales, WorksheetView, Xfrm, XfrmGroup };
3872
+ export type { AdjustCoordinate, AdjustPoint, AdjustValueHandlePolar, AdjustValueHandleXY, ArcToCommand, BlackWhiteMode, BlipFill, BorderStyle, CalcProps, Cell, CellId, CellOffset, CellRange, CellValueType, CloseCommand, Color, Comment, ConnectionPoint, CubicBezierToCommand, DashStop, DataTable, DefinedName, DmlAngle, Drawing, EmuValue, Extent, External, ExternalWorksheet, Fill, FillPatternStyle, FlipAxis, FontStyleIndex, GeomGuideName, GradientColorStop, GradientLinearFill, GradientPathFill, Graphic, GraphicAnchor, GraphicAnchorAbsolute, GraphicAnchorOneCell, GraphicAnchorTwoCell, GraphicBitmap, GraphicChart, GraphicConnectionShape, GraphicGroup, GraphicShape, GridSize, GroupFill, GuidePoint, HAlign, HyperlinkTextRun, InsetRect, Line, LineAlignment, LineCapType, LineCompoundType, LineEnd, LineEndSize, LineEndType, LineJoinType, LineStyle, LineToCommand, MentionTextRun, MoveToCommand, NoFill, Note, Paragraph, Path, PathCommand, PathFillMode, PathFillType, PatternFill, PatternStyle, Percentage, Person, PivotArea, PivotAreaAxis, PivotAreaReference, PivotAreaType, PivotAutoFilterColumn, PivotCache, PivotCacheBase, PivotCacheConsolidation, PivotCacheConsolidationRangeSet, PivotCacheConsolidationSource, PivotCacheExternal, PivotCacheField, PivotCacheFieldGroup, PivotCacheRangePr, PivotCacheRecord, PivotCacheRecordValue, PivotCacheScenario, PivotCacheSharedItem, PivotCacheSharedItemBool, PivotCacheSharedItemDate, PivotCacheSharedItemErr, PivotCacheSharedItemNil, PivotCacheSharedItemNum, PivotCacheSharedItemStr, PivotCacheSharedItemsMeta, PivotCacheWorksheet, PivotCacheWorksheetSource, PivotCacheWorksheetSourceName, PivotCacheWorksheetSourceRange, PivotCalculatedField, PivotCustomFilterCriterion, PivotCustomFilterOperator, PivotDataField, PivotDataFieldAggregation, PivotField, PivotFieldAxis, PivotFieldItem, PivotFilter, PivotFilterType, PivotGroupBy, PivotItemType, PivotPageField, PivotRowColItem, PivotShowDataAs, PivotSubtotalFunction, PivotTable, PivotTableLocation, PivotTableStyle, PivotTableStyleName, PixelValue, Point, PositiveCoordinate, QuadraticBezierToCommand, RectAlignment, RelativeRect, Shape, ShapeRect, ShapeStyle, SolidFill, Style, Table, TableColumn, TableColumnDataType, TableStyle, TableStyleName, TextAnchoring, TextBody, TextHorzOverflow, TextRun, TextVertOverflow, TextVerticalType, TextWrapping, ThreadedComment, Tile, Underline, VAlign, Workbook, WorkbookView, Worksheet, WorksheetDefaults, WorksheetLayoutScales, WorksheetView, Xfrm, XfrmGroup, integer };