-
Notifications
You must be signed in to change notification settings - Fork 63
/
excel.pivotlayout.yml
833 lines (713 loc) · 31.5 KB
/
excel.pivotlayout.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
### YamlMime:TSType
name: Excel.PivotLayout
uid: 'excel!Excel.PivotLayout:class'
package: excel!
fullName: Excel.PivotLayout
summary: Represents the visual layout of the PivotTable.
remarks: '\[ [API set: ExcelApi 1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
type: class
properties:
- name: altTextDescription
uid: 'excel!Excel.PivotLayout#altTextDescription:member'
package: excel!
fullName: altTextDescription
summary: >-
The alt text description of the PivotTable.
Alt text provides alternative, text-based representations of the information contained in the PivotTable. This
information is useful for people with vision or cognitive impairments who may not be able to see or understand the
table. A title can be read to a person with a disability and is used to determine whether they wish to hear the
description of the content.
remarks: >-
\[ [API set: ExcelApi 1.13](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml
await Excel.run(async (context) => {
// Set the alt text for the displayed PivotTable.
const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
const pivotLayout = pivotTable.layout;
pivotLayout.altTextTitle = "Farm Sales PivotTable";
pivotLayout.altTextDescription = "A summary of fruit sales. It is pivoted on farm name, and fruit type. The aggregated data is both the sums of crates sold at the farms and the sums of crates sold wholesale.";
console.log("Adding alt text. Check the PivotTable settings to see the changes.");
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'altTextDescription: string;'
return:
type: string
- name: altTextTitle
uid: 'excel!Excel.PivotLayout#altTextTitle:member'
package: excel!
fullName: altTextTitle
summary: >-
The alt text title of the PivotTable.
Alt text provides alternative, text-based representations of the information contained in the PivotTable. This
information is useful for people with vision or cognitive impairments who may not be able to see or understand the
table. A title can be read to a person with a disability and is used to determine whether they wish to hear the
description of the content.
remarks: '\[ [API set: ExcelApi 1.13](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'altTextTitle: string;'
return:
type: string
- name: autoFormat
uid: 'excel!Excel.PivotLayout#autoFormat:member'
package: excel!
fullName: autoFormat
summary: Specifies if formatting will be automatically formatted when it's refreshed or when fields are moved.
remarks: '\[ [API set: ExcelApi 1.9](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'autoFormat: boolean;'
return:
type: boolean
- name: context
uid: 'excel!Excel.PivotLayout#context:member'
package: excel!
fullName: context
summary: >-
The request context associated with the object. This connects the add-in's process to the Office host
application's process.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'context: RequestContext;'
return:
type: '<xref uid="excel!Excel.RequestContext:class" />'
- name: emptyCellText
uid: 'excel!Excel.PivotLayout#emptyCellText:member'
package: excel!
fullName: emptyCellText
summary: >-
The text that is automatically filled into any empty cell in the PivotTable if `fillEmptyCells == true`<!-- -->.
Note that this value persists if `fillEmptyCells` is set to `false`<!-- -->, and that setting this value does not
set that property to `true`<!-- -->. By default, this is an empty string.
remarks: >-
\[ [API set: ExcelApi 1.13](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml
await Excel.run(async (context) => {
// Set a default value for an empty cell in the PivotTable. This doesn't include cells left blank by the layout.
const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
const pivotLayout = pivotTable.layout;
pivotLayout.emptyCellText = "--";
// Set the text alignment to match the rest of the PivotTable.
pivotLayout.getDataBodyRange().format.horizontalAlignment = Excel.HorizontalAlignment.right;
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'emptyCellText: string;'
return:
type: string
- name: enableFieldList
uid: 'excel!Excel.PivotLayout#enableFieldList:member'
package: excel!
fullName: enableFieldList
summary: Specifies if the field list can be shown in the UI.
remarks: '\[ [API set: ExcelApi 1.10](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'enableFieldList: boolean;'
return:
type: boolean
- name: fillEmptyCells
uid: 'excel!Excel.PivotLayout#fillEmptyCells:member'
package: excel!
fullName: fillEmptyCells
summary: >-
Specifies whether empty cells in the PivotTable should be populated with the `emptyCellText`<!-- -->. Default is
`false`<!-- -->. Note that the value of `emptyCellText` persists when this property is set to `false`<!-- -->.
remarks: >-
\[ [API set: ExcelApi 1.13](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml
await Excel.run(async (context) => {
// Toggle whether empty cells are filled with a default value.
const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
const pivotLayout = pivotTable.layout;
pivotLayout.load("fillEmptyCells");
await context.sync();
let fillToSet = !pivotLayout.fillEmptyCells;
console.log(`Filling empty cells? - ${fillToSet}`);
pivotLayout.fillEmptyCells = fillToSet;
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'fillEmptyCells: boolean;'
return:
type: boolean
- name: layoutType
uid: 'excel!Excel.PivotLayout#layoutType:member'
package: excel!
fullName: layoutType
summary: >-
This property indicates the PivotLayoutType of all fields on the PivotTable. If fields have different states, this
will be null.
remarks: >-
\[ [API set: ExcelApi 1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml
await Excel.run(async (context) => {
// Change the PivotLayout.type to a new type.
const pivotTable = context.workbook.worksheets.getActiveWorksheet().pivotTables.getItem("Farm Sales");
pivotTable.layout.load("layoutType");
await context.sync();
// Cycle between the three layout types.
if (pivotTable.layout.layoutType === "Compact") {
pivotTable.layout.layoutType = "Outline";
} else if (pivotTable.layout.layoutType === "Outline") {
pivotTable.layout.layoutType = "Tabular";
} else {
pivotTable.layout.layoutType = "Compact";
}
await context.sync();
console.log("Pivot layout is now " + pivotTable.layout.layoutType);
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'layoutType: Excel.PivotLayoutType | "Compact" | "Tabular" | "Outline";'
return:
type: '<xref uid="excel!Excel.PivotLayoutType:enum" /> | "Compact" | "Tabular" | "Outline"'
- name: preserveFormatting
uid: 'excel!Excel.PivotLayout#preserveFormatting:member'
package: excel!
fullName: preserveFormatting
summary: >-
Specifies if formatting is preserved when the report is refreshed or recalculated by operations such as pivoting,
sorting, or changing page field items.
remarks: >-
\[ [API set: ExcelApi 1.9](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml
await Excel.run(async (context) => {
// Set whether the PivotTable keeps the established format after it is refreshed and recalculated.
const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
const pivotLayout = pivotTable.layout;
pivotLayout.load("preserveFormatting");
await context.sync();
let preserveFormattingToSet = !pivotLayout.preserveFormatting;
console.log(`Preserve the formatting PivotTable after a refresh? - ${preserveFormattingToSet}`);
pivotLayout.preserveFormatting = preserveFormattingToSet;
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'preserveFormatting: boolean;'
return:
type: boolean
- name: showColumnGrandTotals
uid: 'excel!Excel.PivotLayout#showColumnGrandTotals:member'
package: excel!
fullName: showColumnGrandTotals
summary: Specifies if the PivotTable report shows grand totals for columns.
remarks: >-
\[ [API set: ExcelApi 1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml
await Excel.run(async (context) => {
// Turn the grand totals on and off for the rows and columns.
const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
const pivotLayout = pivotTable.layout;
pivotLayout.load(["showRowGrandTotals", "showColumnGrandTotals"]);
await context.sync();
let showColumnTotals = !pivotLayout.showColumnGrandTotals;
let showRowTotals = !pivotLayout.showRowGrandTotals;
console.log(`Show column grand totals? - ${showColumnTotals}`);
console.log(`Show row grand totals? - ${showRowTotals}`);
pivotLayout.showColumnGrandTotals = showColumnTotals;
pivotLayout.showRowGrandTotals = showRowTotals;
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'showColumnGrandTotals: boolean;'
return:
type: boolean
- name: showFieldHeaders
uid: 'excel!Excel.PivotLayout#showFieldHeaders:member'
package: excel!
fullName: showFieldHeaders
summary: Specifies whether the PivotTable displays field headers (field captions and filter drop-downs).
remarks: >-
\[ [API set: ExcelApi 1.13](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml
await Excel.run(async (context) => {
// Turn the field headers on and off for the row and column hierarchies.
const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
const pivotLayout = pivotTable.layout;
pivotLayout.load("showFieldHeaders");
await context.sync();
let showHeaders = !pivotLayout.showFieldHeaders;
console.log(`Show field headers? - ${showHeaders}`);
pivotLayout.showFieldHeaders = showHeaders;
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'showFieldHeaders: boolean;'
return:
type: boolean
- name: showRowGrandTotals
uid: 'excel!Excel.PivotLayout#showRowGrandTotals:member'
package: excel!
fullName: showRowGrandTotals
summary: Specifies if the PivotTable report shows grand totals for rows.
remarks: >-
\[ [API set: ExcelApi 1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml
await Excel.run(async (context) => {
// Turn the grand totals on and off for the rows and columns.
const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
const pivotLayout = pivotTable.layout;
pivotLayout.load(["showRowGrandTotals", "showColumnGrandTotals"]);
await context.sync();
let showColumnTotals = !pivotLayout.showColumnGrandTotals;
let showRowTotals = !pivotLayout.showRowGrandTotals;
console.log(`Show column grand totals? - ${showColumnTotals}`);
console.log(`Show row grand totals? - ${showRowTotals}`);
pivotLayout.showColumnGrandTotals = showColumnTotals;
pivotLayout.showRowGrandTotals = showRowTotals;
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'showRowGrandTotals: boolean;'
return:
type: boolean
- name: subtotalLocation
uid: 'excel!Excel.PivotLayout#subtotalLocation:member'
package: excel!
fullName: subtotalLocation
summary: >-
This property indicates the `SubtotalLocationType` of all fields on the PivotTable. If fields have different
states, this will be `null`<!-- -->.
remarks: '\[ [API set: ExcelApi 1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'subtotalLocation: Excel.SubtotalLocationType | "AtTop" | "AtBottom" | "Off";'
return:
type: '<xref uid="excel!Excel.SubtotalLocationType:enum" /> | "AtTop" | "AtBottom" | "Off"'
methods:
- name: displayBlankLineAfterEachItem(display)
uid: 'excel!Excel.PivotLayout#displayBlankLineAfterEachItem:member(1)'
package: excel!
fullName: displayBlankLineAfterEachItem(display)
summary: >-
Sets whether or not to display a blank line after each item. This is set at the global level for the PivotTable
and applied to individual PivotFields. This function overwrites the setting for all fields in the PivotTable to
the value of `display` parameter.
remarks: >-
\[ [API set: ExcelApi 1.13](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml
await Excel.run(async (context) => {
// Add a blank row after each PivotItem in the row hierarchy.
const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
const pivotLayout = pivotTable.layout;
pivotLayout.displayBlankLineAfterEachItem(true);
console.log("Setting `PivotLayout.displayBlankLineAfterEachItem` to true.");
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'displayBlankLineAfterEachItem(display: boolean): void;'
parameters:
- id: display
description: True turns on the blank-line display setting. False turns it off.
type: boolean
return:
type: void
description: ''
- name: getColumnLabelRange()
uid: 'excel!Excel.PivotLayout#getColumnLabelRange:member(1)'
package: excel!
fullName: getColumnLabelRange()
summary: Returns the range where the PivotTable's column labels reside.
remarks: '\[ [API set: ExcelApi 1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'getColumnLabelRange(): Excel.Range;'
return:
type: '<xref uid="excel!Excel.Range:class" />'
description: ''
- name: getDataBodyRange()
uid: 'excel!Excel.PivotLayout#getDataBodyRange:member(1)'
package: excel!
fullName: getDataBodyRange()
summary: Returns the range where the PivotTable's data values reside.
remarks: >-
\[ [API set: ExcelApi 1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-filters-and-summaries.yaml
await Excel.run(async (context) => {
const pivotTable = context.workbook.worksheets.getActiveWorksheet().pivotTables.getItem("Farm Sales");
// The layout controls the ranges used by the PivotTable.
const range = pivotTable.layout.getDataBodyRange();
// Get all the data hierarchy totals.
const grandTotalRange = range.getLastRow();
grandTotalRange.load("address");
await context.sync();
// Use the wholesale and farm sale totals to make a final sum.
const masterTotalRange = context.workbook.worksheets.getActiveWorksheet().getRange("B27:C27");
masterTotalRange.formulas = [["All Crates", "=SUM(" + grandTotalRange.address + ")"]];
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'getDataBodyRange(): Excel.Range;'
return:
type: '<xref uid="excel!Excel.Range:class" />'
description: ''
- name: getDataHierarchy(cell)
uid: 'excel!Excel.PivotLayout#getDataHierarchy:member(1)'
package: excel!
fullName: getDataHierarchy(cell)
summary: Gets the DataHierarchy that is used to calculate the value in a specified range within the PivotTable.
remarks: '\[ [API set: ExcelApi 1.9](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'getDataHierarchy(cell: Range | string): Excel.DataPivotHierarchy;'
parameters:
- id: cell
description: A single cell within the PivotTable data body.
type: '<xref uid="excel!Excel.Range:class" /> | string'
return:
type: '<xref uid="excel!Excel.DataPivotHierarchy:class" />'
description: The DataPivotHierarchy object used to calculate the value in the specified cell.
- name: getFilterAxisRange()
uid: 'excel!Excel.PivotLayout#getFilterAxisRange:member(1)'
package: excel!
fullName: getFilterAxisRange()
summary: Returns the range of the PivotTable's filter area.
remarks: '\[ [API set: ExcelApi 1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'getFilterAxisRange(): Excel.Range;'
return:
type: '<xref uid="excel!Excel.Range:class" />'
description: ''
- name: 'getPivotItems(axis, cell)'
uid: 'excel!Excel.PivotLayout#getPivotItems:member(1)'
package: excel!
fullName: 'getPivotItems(axis, cell)'
summary: Gets the PivotItems from an axis that make up the value in a specified range within the PivotTable.
remarks: '\[ [API set: ExcelApi 1.9](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'getPivotItems(axis: Excel.PivotAxis, cell: Range | string): Excel.PivotItemCollection;'
parameters:
- id: axis
description: The axis from which to get the PivotItems. Must be either "row" or "column."
type: '<xref uid="excel!Excel.PivotAxis:enum" />'
- id: cell
description: A single cell within the PivotTable's data body.
type: '<xref uid="excel!Excel.Range:class" /> | string'
return:
type: '<xref uid="excel!Excel.PivotItemCollection:class" />'
description: A PivotItemCollection of the PivotItems that are used to calculate the values in the specified row.
- name: 'getPivotItems(axisString, cell)'
uid: 'excel!Excel.PivotLayout#getPivotItems:member(2)'
package: excel!
fullName: 'getPivotItems(axisString, cell)'
summary: Gets the PivotItems from an axis that make up the value in a specified range within the PivotTable.
remarks: '\[ [API set: ExcelApi 1.9](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: >-
getPivotItems(axisString: "Unknown" | "Row" | "Column" | "Data" | "Filter", cell: Range | string):
Excel.PivotItemCollection;
parameters:
- id: axisString
description: The axis from which to get the PivotItems. Must be either "row" or "column."
type: '"Unknown" | "Row" | "Column" | "Data" | "Filter"'
- id: cell
description: A single cell within the PivotTable's data body.
type: '<xref uid="excel!Excel.Range:class" /> | string'
return:
type: '<xref uid="excel!Excel.PivotItemCollection:class" />'
description: A PivotItemCollection of the PivotItems that are used to calculate the values in the specified row.
- name: getRange()
uid: 'excel!Excel.PivotLayout#getRange:member(1)'
package: excel!
fullName: getRange()
summary: 'Returns the range the PivotTable exists on, excluding the filter area.'
remarks: '\[ [API set: ExcelApi 1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'getRange(): Excel.Range;'
return:
type: '<xref uid="excel!Excel.Range:class" />'
description: ''
- name: getRowLabelRange()
uid: 'excel!Excel.PivotLayout#getRowLabelRange:member(1)'
package: excel!
fullName: getRowLabelRange()
summary: Returns the range where the PivotTable's row labels reside.
remarks: '\[ [API set: ExcelApi 1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'getRowLabelRange(): Excel.Range;'
return:
type: '<xref uid="excel!Excel.Range:class" />'
description: ''
- name: load(options)
uid: 'excel!Excel.PivotLayout#load:member(1)'
package: excel!
fullName: load(options)
summary: >-
Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading
the properties.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'load(options?: Excel.Interfaces.PivotLayoutLoadOptions): Excel.PivotLayout;'
parameters:
- id: options
description: Provides options for which properties of the object to load.
type: '<xref uid="excel!Excel.Interfaces.PivotLayoutLoadOptions:interface" />'
return:
type: '<xref uid="excel!Excel.PivotLayout:class" />'
description: ''
- name: load(propertyNames)
uid: 'excel!Excel.PivotLayout#load:member(2)'
package: excel!
fullName: load(propertyNames)
summary: >-
Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading
the properties.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'load(propertyNames?: string | string[]): Excel.PivotLayout;'
parameters:
- id: propertyNames
description: A comma-delimited string or an array of strings that specify the properties to load.
type: 'string | string[]'
return:
type: '<xref uid="excel!Excel.PivotLayout:class" />'
description: ''
- name: load(propertyNamesAndPaths)
uid: 'excel!Excel.PivotLayout#load:member(3)'
package: excel!
fullName: load(propertyNamesAndPaths)
summary: >-
Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading
the properties.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: |-
load(propertyNamesAndPaths?: {
select?: string;
expand?: string;
}): Excel.PivotLayout;
parameters:
- id: propertyNamesAndPaths
description: >-
`propertyNamesAndPaths.select` is a comma-delimited string that specifies the properties to load, and
`propertyNamesAndPaths.expand` is a comma-delimited string that specifies the navigation properties to load.
type: |-
{
select?: string;
expand?: string;
}
return:
type: '<xref uid="excel!Excel.PivotLayout:class" />'
description: ''
- name: repeatAllItemLabels(repeatLabels)
uid: 'excel!Excel.PivotLayout#repeatAllItemLabels:member(1)'
package: excel!
fullName: repeatAllItemLabels(repeatLabels)
summary: Sets the "repeat all item labels" setting across all fields in the PivotTable.
remarks: >-
\[ [API set: ExcelApi 1.13](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotlayout.yaml
await Excel.run(async (context) => {
// Repeat the PivotItem labels for each row used by another level of the row hierarchy.
const pivotTable = context.workbook.pivotTables.getItem("Farm Sales");
const pivotLayout = pivotTable.layout;
pivotLayout.repeatAllItemLabels(true);
console.log("Setting `PivotLayout.repeatAllItemLabels` to true.");
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'repeatAllItemLabels(repeatLabels: boolean): void;'
parameters:
- id: repeatLabels
description: True turns on the label-repetition display setting. False turns it off.
type: boolean
return:
type: void
description: ''
- name: 'set(properties, options)'
uid: 'excel!Excel.PivotLayout#set:member(1)'
package: excel!
fullName: 'set(properties, options)'
summary: >-
Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate
properties, or another API object of the same type.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'set(properties: Interfaces.PivotLayoutUpdateData, options?: OfficeExtension.UpdateOptions): void;'
parameters:
- id: properties
description: >-
A JavaScript object with properties that are structured isomorphically to the properties of the object on
which the method is called.
type: '<xref uid="excel!Excel.Interfaces.PivotLayoutUpdateData:interface" />'
- id: options
description: Provides an option to suppress errors if the properties object tries to set any read-only properties.
type: '<xref uid="office!OfficeExtension.UpdateOptions:interface" />'
return:
type: void
description: ''
- name: set(properties)
uid: 'excel!Excel.PivotLayout#set:member(2)'
package: excel!
fullName: set(properties)
summary: 'Sets multiple properties on the object at the same time, based on an existing loaded object.'
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'set(properties: Excel.PivotLayout): void;'
parameters:
- id: properties
description: ''
type: '<xref uid="excel!Excel.PivotLayout:class" />'
return:
type: void
description: ''
- name: 'setAutoSortOnCell(cell, sortBy)'
uid: 'excel!Excel.PivotLayout#setAutoSortOnCell:member(1)'
package: excel!
fullName: 'setAutoSortOnCell(cell, sortBy)'
summary: >-
Sets the PivotTable to automatically sort using the specified cell to automatically select all necessary criteria
and context. This behaves identically to applying an autosort from the UI.
remarks: '\[ [API set: ExcelApi 1.9](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'setAutoSortOnCell(cell: Range | string, sortBy: Excel.SortBy): void;'
parameters:
- id: cell
description: A single cell to use get the criteria from for applying the autosort.
type: '<xref uid="excel!Excel.Range:class" /> | string'
- id: sortBy
description: The direction of the sort.
type: '<xref uid="excel!Excel.SortBy:enum" />'
return:
type: void
description: ''
- name: 'setAutoSortOnCell(cell, sortByString)'
uid: 'excel!Excel.PivotLayout#setAutoSortOnCell:member(2)'
package: excel!
fullName: 'setAutoSortOnCell(cell, sortByString)'
summary: >-
Sets the PivotTable to automatically sort using the specified cell to automatically select all necessary criteria
and context. This behaves identically to applying an autosort from the UI.
remarks: '\[ [API set: ExcelApi 1.9](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'setAutoSortOnCell(cell: Range | string, sortByString: "Ascending" | "Descending"): void;'
parameters:
- id: cell
description: A single cell to use get the criteria from for applying the autosort.
type: '<xref uid="excel!Excel.Range:class" /> | string'
- id: sortByString
description: The direction of the sort.
type: '"Ascending" | "Descending"'
return:
type: void
description: ''
- name: toJSON()
uid: 'excel!Excel.PivotLayout#toJSON:member(1)'
package: excel!
fullName: toJSON()
summary: >-
Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to
`JSON.stringify()`<!-- -->. (`JSON.stringify`<!-- -->, in turn, calls the `toJSON` method of the object that is
passed to it.) Whereas the original Excel.PivotLayout object is an API object, the `toJSON` method returns a plain
JavaScript object (typed as `Excel.Interfaces.PivotLayoutData`<!-- -->) that contains shallow copies of any loaded
child properties from the original object.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'toJSON(): Excel.Interfaces.PivotLayoutData;'
return:
type: '<xref uid="excel!Excel.Interfaces.PivotLayoutData:interface" />'
description: ''
extends: '<xref uid="office!OfficeExtension.ClientObject:class" />'