Skip to content

Commit e77aeda

Browse files
authored
Additional samples for high-traffic pages (#321)
1 parent 403780b commit e77aeda

File tree

5 files changed

+134
-10
lines changed

5 files changed

+134
-10
lines changed

docs/docs-ref-autogen/excel/excelscript/excelscript.filter.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ remarks: |-
2121
// Get the filter for the "PageViews" table column.
2222
const pageViewFilter : ExcelScript.Filter = table.getColumnByName("PageViews").getFilter();
2323
24-
// Apply a filter to only show the rows in the top 10% of values in this column.
24+
// Apply a filter to only show the rows with the top 10% of values in this column.
2525
pageViewFilter.applyTopPercentFilter(10);
2626
}
2727
```
@@ -297,7 +297,24 @@ methods:
297297
content: 'clear(): void;'
298298
return:
299299
type: void
300-
description: ''
300+
description: |-
301+
302+
303+
#### Examples
304+
305+
```TypeScript
306+
/**
307+
* This script shows how to clear a filter from a table column.
308+
*/
309+
function main(workbook: ExcelScript.Workbook) {
310+
// Get the first table in the workbook.
311+
const table = workbook.getTables()[0];
312+
313+
// Clear the filter for the table column named "Status".
314+
const statusColumnFilter = table.getColumn("Status").getFilter();
315+
statusColumnFilter.clear();
316+
}
317+
```
301318
- name: getCriteria()
302319
uid: 'ExcelScript!ExcelScript.Filter#getCriteria:member(1)'
303320
package: ExcelScript!

docs/docs-ref-autogen/excel/excelscript/excelscript.range.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,7 +2218,24 @@ methods:
22182218
type: boolean
22192219
return:
22202220
type: void
2221-
description: ''
2221+
description: |-
2222+
2223+
2224+
#### Examples
2225+
2226+
```TypeScript
2227+
/**
2228+
* This script merges a group of cells into a single region.
2229+
*/
2230+
function main(workbook: ExcelScript.Workbook) {
2231+
// Get the active worksheet.
2232+
const selectedSheet = workbook.getActiveWorksheet();
2233+
2234+
// Merge cells A1 through A4.
2235+
const range = selectedSheet.getRange("A1:A4");
2236+
range.merge();
2237+
}
2238+
```
22222239
- name: moveTo(destinationRange)
22232240
uid: 'ExcelScript!ExcelScript.Range#moveTo:member(1)'
22242241
package: ExcelScript!
@@ -2850,4 +2867,21 @@ methods:
28502867
content: 'unmerge(): void;'
28512868
return:
28522869
type: void
2853-
description: ''
2870+
description: |-
2871+
2872+
2873+
#### Examples
2874+
2875+
```TypeScript
2876+
/**
2877+
* This script unmerges every used cell in the current worksheet.
2878+
*/
2879+
function main(workbook: ExcelScript.Workbook) {
2880+
// Get the active worksheet.
2881+
const selectedSheet = workbook.getActiveWorksheet();
2882+
2883+
// Separate all regions into single cells in the currently used range.
2884+
const range = selectedSheet.getUsedRange();
2885+
range.unmerge();
2886+
}
2887+
```

docs/docs-ref-autogen/excel/excelscript/excelscript.tablecolumn.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,26 @@ uid: 'ExcelScript!ExcelScript.TableColumn:interface'
44
package: ExcelScript!
55
fullName: ExcelScript.TableColumn
66
summary: Represents a column in a table.
7-
remarks: ''
7+
remarks: |-
8+
9+
10+
#### Examples
11+
12+
```TypeScript
13+
/**
14+
* This script shows how to get the range of a table column.
15+
*/
16+
function main(workbook: ExcelScript.Workbook) {
17+
// Get the first table in the workbook.
18+
const table = workbook.getTables()[0];
19+
20+
// Get the range of the table column named "Type".
21+
const typeColumn : ExcelScript.TableColumn = table.getColumn("Type");
22+
const range = typeColumn.getRange();
23+
24+
// Do something with the range...
25+
}
26+
```
827
isPreview: false
928
isDeprecated: false
1029
type: interface
@@ -70,7 +89,7 @@ methods:
7089
// Get the filter for the "PageViews" table column.
7190
const pageViewFilter = table.getColumnByName("PageViews").getFilter();
7291
73-
// Apply a filter to only show the rows in the top 10% of values in this column.
92+
// Apply a filter to only show the rows with the top 10% of values in this column.
7493
pageViewFilter.applyTopPercentFilter(10);
7594
}
7695
```

docs/sample-scripts/excel-scripts.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,6 +2202,19 @@
22022202
const typeColumn = table.getColumnByName("Type");
22032203
typeColumn.getFilter().applyValuesFilter(["Needs Review"]);
22042204
}
2205+
'ExcelScript.Filter#clear:member(1)':
2206+
- |-
2207+
/**
2208+
* This script shows how to clear a filter from a table column.
2209+
*/
2210+
function main(workbook: ExcelScript.Workbook) {
2211+
// Get the first table in the workbook.
2212+
const table = workbook.getTables()[0];
2213+
2214+
// Clear the filter for the table column named "Status".
2215+
const statusColumnFilter = table.getColumn("Status").getFilter();
2216+
statusColumnFilter.clear();
2217+
}
22052218
'ExcelScript.FilterCriteria#criterion1:member':
22062219
- |-
22072220
/**
@@ -4043,6 +4056,19 @@
40434056
// Add the headers.
40444057
currentSheet.getRange("A1:C1").setValues(myHeaders);
40454058
}
4059+
'ExcelScript.Range#merge:member(1)':
4060+
- |-
4061+
/**
4062+
* This script merges a group of cells into a single region.
4063+
*/
4064+
function main(workbook: ExcelScript.Workbook) {
4065+
// Get the active worksheet.
4066+
const selectedSheet = workbook.getActiveWorksheet();
4067+
4068+
// Merge cells A1 through A4.
4069+
const range = selectedSheet.getRange("A1:A4");
4070+
range.merge();
4071+
}
40464072
'ExcelScript.Range#replaceAll:member(1)':
40474073
- |-
40484074
/**
@@ -4184,6 +4210,19 @@
41844210
, ['4/17/2020', 'Mariya', 'Salads', '$1600']
41854211
, ['4/28/2020', 'Laura', 'Sandwiches', '$680']
41864212
];
4213+
'ExcelScript.Range#unmerge:member(1)':
4214+
- |-
4215+
/**
4216+
* This script unmerges every used cell in the current worksheet.
4217+
*/
4218+
function main(workbook: ExcelScript.Workbook) {
4219+
// Get the active worksheet.
4220+
const selectedSheet = workbook.getActiveWorksheet();
4221+
4222+
// Separate all regions into single cells in the currently used range.
4223+
const range = selectedSheet.getUsedRange();
4224+
range.unmerge();
4225+
}
41874226
'ExcelScript.RangeAreas:interface':
41884227
- |-
41894228
/**
@@ -5486,6 +5525,21 @@
54865525
// Set the Total Row to show.
54875526
table.setShowTotals(true);
54885527
}
5528+
'ExcelScript.TableColumn:interface':
5529+
- |-
5530+
/**
5531+
* This script shows how to get the range of a table column.
5532+
*/
5533+
function main(workbook: ExcelScript.Workbook) {
5534+
// Get the first table in the workbook.
5535+
const table = workbook.getTables()[0];
5536+
5537+
// Get the range of the table column named "Type".
5538+
const typeColumn : ExcelScript.TableColumn = table.getColumn("Type");
5539+
const range = typeColumn.getRange();
5540+
5541+
// Do something with the range...
5542+
}
54895543
'ExcelScript.TableColumn#delete:member(1)':
54905544
- |-
54915545
/**

generate-docs/API Coverage Report.csv

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ ExcelScript.Filter,"applyIconFilter(icon)",Method,Poor,false
15791579
ExcelScript.Filter,"applyTopItemsFilter(count)",Method,Poor,false
15801580
ExcelScript.Filter,"applyTopPercentFilter(percent)",Method,Poor,false
15811581
ExcelScript.Filter,"applyValuesFilter(values)",Method,Fine,true
1582-
ExcelScript.Filter,"clear()",Method,Poor,false
1582+
ExcelScript.Filter,"clear()",Method,Poor,true
15831583
ExcelScript.Filter,"getCriteria()",Method,Poor,false
15841584
ExcelScript.FilterCriteria,N/A,Class,Fine,false
15851585
ExcelScript.FilterCriteria,"color",Property,Good,false
@@ -2451,7 +2451,7 @@ ExcelScript.Range,"getWorksheet()",Method,Poor,false
24512451
ExcelScript.Range,"group(groupOption)",Method,Fine,true
24522452
ExcelScript.Range,"hideGroupDetails(groupOption)",Method,Poor,false
24532453
ExcelScript.Range,"insert(shift)",Method,Fine,true
2454-
ExcelScript.Range,"merge(across)",Method,Poor,false
2454+
ExcelScript.Range,"merge(across)",Method,Fine,true
24552455
ExcelScript.Range,"moveTo(destinationRange)",Method,Poor,false
24562456
ExcelScript.Range,"removeDuplicates(columns, includesHeader)",Method,Poor,false
24572457
ExcelScript.Range,"replaceAll(text, replacement, criteria)",Method,Poor,true
@@ -2476,7 +2476,7 @@ ExcelScript.Range,"setValues(values)",Method,Poor,true
24762476
ExcelScript.Range,"showCard()",Method,Poor,false
24772477
ExcelScript.Range,"showGroupDetails(groupOption)",Method,Poor,false
24782478
ExcelScript.Range,"ungroup(groupOption)",Method,Poor,false
2479-
ExcelScript.Range,"unmerge()",Method,Poor,false
2479+
ExcelScript.Range,"unmerge()",Method,Poor,true
24802480
ExcelScript.RangeAreas,N/A,Class,Fine,true
24812481
ExcelScript.RangeAreas,"addConditionalFormat(type)",Method,Poor,false
24822482
ExcelScript.RangeAreas,"calculate()",Method,Poor,false
@@ -3020,7 +3020,7 @@ ExcelScript.Table,"setShowBandedRows(showBandedRows)",Method,Poor,false
30203020
ExcelScript.Table,"setShowFilterButton(showFilterButton)",Method,Poor,false
30213021
ExcelScript.Table,"setShowHeaders(showHeaders)",Method,Poor,true
30223022
ExcelScript.Table,"setShowTotals(showTotals)",Method,Poor,true
3023-
ExcelScript.TableColumn,N/A,Class,Fine,false
3023+
ExcelScript.TableColumn,N/A,Class,Fine,true
30243024
ExcelScript.TableColumn,"delete()",Method,Poor,true
30253025
ExcelScript.TableColumn,"getFilter()",Method,Poor,true
30263026
ExcelScript.TableColumn,"getHeaderRowRange()",Method,Poor,false

0 commit comments

Comments
 (0)