/
excelscript.tablecolumn.yml
230 lines (210 loc) · 7.25 KB
/
excelscript.tablecolumn.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
### YamlMime:TSType
name: ExcelScript.TableColumn
uid: 'ExcelScript!ExcelScript.TableColumn:interface'
package: ExcelScript!
fullName: ExcelScript.TableColumn
summary: Represents a column in a table.
remarks: |-
#### Examples
```TypeScript
/**
* This script shows how to get the range of a table column.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the first table in the workbook.
const table = workbook.getTables()[0];
// Get the range of the table column named "Type".
const typeColumn : ExcelScript.TableColumn = table.getColumn("Type");
const range = typeColumn.getRange();
// Do something with the range...
}
```
isPreview: false
isDeprecated: false
type: interface
methods:
- name: delete()
uid: 'ExcelScript!ExcelScript.TableColumn#delete:member(1)'
package: ExcelScript!
fullName: delete()
summary: Deletes the column from the table.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'delete(): void;'
return:
type: void
description: |-
#### Examples
```TypeScript
/**
* This script removes a specific column from a table.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the table named "Inventory".
const table = workbook.getTable("Inventory");
// If it exists, remove the column named "Category".
let categoryColumn = table.getColumnByName("Category");
if (categoryColumn) {
categoryColumn.delete();
}
}
```
- name: getFilter()
uid: 'ExcelScript!ExcelScript.TableColumn#getFilter:member(1)'
package: ExcelScript!
fullName: getFilter()
summary: Retrieves the filter applied to the column.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'getFilter(): Filter;'
return:
type: '<xref uid="ExcelScript!ExcelScript.Filter:interface" />'
description: |-
#### Examples
```TypeScript
/**
* This script adds a table filter to only show the top 10% of values
* belonging to a particular column.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the first table on the current worksheet.
const table = workbook.getActiveWorksheet().getTables()[0];
// Get the filter for the "PageViews" table column.
const pageViewFilter = table.getColumnByName("PageViews").getFilter();
// Apply a filter to only show the rows with the top 10% of values in this column.
pageViewFilter.applyTopPercentFilter(10);
}
```
- name: getHeaderRowRange()
uid: 'ExcelScript!ExcelScript.TableColumn#getHeaderRowRange:member(1)'
package: ExcelScript!
fullName: getHeaderRowRange()
summary: Gets the range object associated with the header row of the column.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'getHeaderRowRange(): Range;'
return:
type: '<xref uid="ExcelScript!ExcelScript.Range:interface" />'
description: ''
- name: getId()
uid: 'ExcelScript!ExcelScript.TableColumn#getId:member(1)'
package: ExcelScript!
fullName: getId()
summary: Returns a unique key that identifies the column within the table.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'getId(): number;'
return:
type: number
description: ''
- name: getIndex()
uid: 'ExcelScript!ExcelScript.TableColumn#getIndex:member(1)'
package: ExcelScript!
fullName: getIndex()
summary: Returns the index number of the column within the columns collection of the table. Zero-indexed.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'getIndex(): number;'
return:
type: number
description: ''
- name: getName()
uid: 'ExcelScript!ExcelScript.TableColumn#getName:member(1)'
package: ExcelScript!
fullName: getName()
summary: Specifies the name of the table column.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'getName(): string;'
return:
type: string
description: ''
- name: getRange()
uid: 'ExcelScript!ExcelScript.TableColumn#getRange:member(1)'
package: ExcelScript!
fullName: getRange()
summary: Gets the range object associated with the entire column.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'getRange(): Range;'
return:
type: '<xref uid="ExcelScript!ExcelScript.Range:interface" />'
description: ''
- name: getRangeBetweenHeaderAndTotal()
uid: 'ExcelScript!ExcelScript.TableColumn#getRangeBetweenHeaderAndTotal:member(1)'
package: ExcelScript!
fullName: getRangeBetweenHeaderAndTotal()
summary: Gets the range object associated with the data body of the column.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'getRangeBetweenHeaderAndTotal(): Range;'
return:
type: '<xref uid="ExcelScript!ExcelScript.Range:interface" />'
description: |-
#### Examples
```TypeScript
/**
* This script adds a new column to a table.
* It then sets the formulas in the new column to be the product
* of the values in the two preceding columns.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the first table in the workbook.
const table = workbook.getTables()[0];
// Append an empty column to the table with the header "Total".
const totalColumn = table.addColumn(-1, null, "Total");
// Get the names of the two preceding columns.
const productColumnName1 = table.getColumns()[totalColumn.getIndex() - 1].getName();
const productColumnName2 = table.getColumns()[totalColumn.getIndex() - 2].getName();
// Set the formulas in the "Total" column to be the product of the two preceding columns.
totalColumn.getRangeBetweenHeaderAndTotal().setFormula(
`=[@[${productColumnName1}]]*[@[${productColumnName2}]]`
);
}
```
- name: getTotalRowRange()
uid: 'ExcelScript!ExcelScript.TableColumn#getTotalRowRange:member(1)'
package: ExcelScript!
fullName: getTotalRowRange()
summary: Gets the range object associated with the totals row of the column.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'getTotalRowRange(): Range;'
return:
type: '<xref uid="ExcelScript!ExcelScript.Range:interface" />'
description: ''
- name: setName(name)
uid: 'ExcelScript!ExcelScript.TableColumn#setName:member(1)'
package: ExcelScript!
fullName: setName(name)
summary: Specifies the name of the table column.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'setName(name: string): void;'
parameters:
- id: name
description: ''
type: string
return:
type: void
description: ''