|
456 | 456 | await Excel.run(async (context) => {
|
457 | 457 | const sheet = context.workbook.worksheets.getActiveWorksheet();
|
458 | 458 |
|
459 |
| - // Get the second column in the table. |
460 |
| - const range = sheet.getRange("FruitTable").getColumn(1); |
| 459 | + // Get the second column in the table, without the header. |
| 460 | + const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange(); |
461 | 461 |
|
462 | 462 | // Change the boolean values to checkboxes.
|
463 | 463 | range.control = {
|
|
476 | 476 | await Excel.run(async (context) => {
|
477 | 477 | const sheet = context.workbook.worksheets.getActiveWorksheet();
|
478 | 478 |
|
479 |
| - // Get the second column in the table. |
480 |
| - const range = sheet.getRange("FruitTable").getColumn(1); |
| 479 | + // Get the second column in the table, without the header. |
| 480 | + const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange(); |
481 | 481 |
|
482 | 482 | // Change the boolean values to checkboxes.
|
483 | 483 | range.control = {
|
|
1722 | 1722 | await Excel.run(async (context) => {
|
1723 | 1723 | const sheet = context.workbook.worksheets.getActiveWorksheet();
|
1724 | 1724 |
|
1725 |
| - // Get the second column in the table. |
1726 |
| - const range = sheet.getRange("FruitTable").getColumn(1); |
| 1725 | + // Get the second column in the table, without the header. |
| 1726 | + const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange(); |
1727 | 1727 |
|
1728 | 1728 | // Change the boolean values to checkboxes.
|
1729 | 1729 | range.control = {
|
|
5127 | 5127 | await Excel.run(async (context) => {
|
5128 | 5128 | const sheet = context.workbook.worksheets.getActiveWorksheet();
|
5129 | 5129 |
|
5130 |
| - // Get the second column in the table. |
5131 |
| - const range = sheet.getRange("FruitTable").getColumn(1); |
| 5130 | + // Get the second column in the table, without the header. |
| 5131 | + const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange(); |
5132 | 5132 |
|
5133 | 5133 | // Clear all the data from the second column.
|
5134 | 5134 | range.clearOrResetContents();
|
|
5161 | 5161 | await Excel.run(async (context) => {
|
5162 | 5162 | const sheet = context.workbook.worksheets.getActiveWorksheet();
|
5163 | 5163 |
|
5164 |
| - // Get the second column in the table. |
5165 |
| - const range = sheet.getRange("FruitTable").getColumn(1); |
| 5164 | + // Get the second column in the table, without the header. |
| 5165 | + const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange(); |
5166 | 5166 |
|
5167 | 5167 | // Change the boolean values to checkboxes.
|
5168 | 5168 | range.control = {
|
|
5251 | 5251 | console.log(
|
5252 | 5252 | `Address: ${cellProperties.address}\nStyle: ${cellProperties.style}\nFill Color: ${cellProperties.format.fill.color}\nFont Color: ${cellProperties.format.font.color}`);
|
5253 | 5253 | });
|
5254 |
| -'Excel.Range#getColumn:member(1)': |
5255 |
| - - >- |
5256 |
| - // Link to full sample: |
5257 |
| - https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/range-cell-control.yaml |
5258 |
| - |
5259 |
| - |
5260 |
| - // Add checkboxes to the table. |
5261 |
| - |
5262 |
| - await Excel.run(async (context) => { |
5263 |
| - const sheet = context.workbook.worksheets.getActiveWorksheet(); |
5264 |
| - |
5265 |
| - // Get the second column in the table. |
5266 |
| - const range = sheet.getRange("FruitTable").getColumn(1); |
5267 |
| - |
5268 |
| - // Change the boolean values to checkboxes. |
5269 |
| - range.control = { |
5270 |
| - type: Excel.CellControlType.checkbox |
5271 |
| - }; |
5272 |
| - await context.sync(); |
5273 |
| - }); |
5274 | 5254 | 'Excel.Range#getDependents:member(1)':
|
5275 | 5255 | - >-
|
5276 | 5256 | // Link to full sample:
|
|
7192 | 7172 | console.log("Worksheet Id : " + worksheet.name);
|
7193 | 7173 | });
|
7194 | 7174 | }
|
| 7175 | +'Excel.TableCollection:class': |
| 7176 | + - >- |
| 7177 | + // Link to full sample: |
| 7178 | + https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/range-cell-control.yaml |
| 7179 | + |
| 7180 | + |
| 7181 | + // Add checkboxes to the table. |
| 7182 | + |
| 7183 | + await Excel.run(async (context) => { |
| 7184 | + const sheet = context.workbook.worksheets.getActiveWorksheet(); |
| 7185 | + |
| 7186 | + // Get the second column in the table, without the header. |
| 7187 | + const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange(); |
| 7188 | + |
| 7189 | + // Change the boolean values to checkboxes. |
| 7190 | + range.control = { |
| 7191 | + type: Excel.CellControlType.checkbox |
| 7192 | + }; |
| 7193 | + await context.sync(); |
| 7194 | + }); |
| 7195 | +'Excel.TableCollection#getItem:member(1)': |
| 7196 | + - >- |
| 7197 | + // Link to full sample: |
| 7198 | + https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/range-cell-control.yaml |
| 7199 | + |
| 7200 | + |
| 7201 | + // Remove checkboxes from the table. |
| 7202 | + |
| 7203 | + await Excel.run(async (context) => { |
| 7204 | + const sheet = context.workbook.worksheets.getActiveWorksheet(); |
| 7205 | + |
| 7206 | + // Get the second column in the table, without the header. |
| 7207 | + const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange(); |
| 7208 | + |
| 7209 | + // Change the checkboxes back to boolean values. |
| 7210 | + range.control = { |
| 7211 | + type: Excel.CellControlType.empty |
| 7212 | + }; |
| 7213 | + await context.sync(); |
| 7214 | + }); |
7195 | 7215 | 'Excel.TableCollection#onChanged:member':
|
7196 | 7216 | - >-
|
7197 | 7217 | // Link to full sample:
|
|
7205 | 7225 | await context.sync();
|
7206 | 7226 | console.log("A handler has been registered for the table collection onChanged event");
|
7207 | 7227 | });
|
| 7228 | +'Excel.TableColumn#getDataBodyRange:member(1)': |
| 7229 | + - >- |
| 7230 | + // Link to full sample: |
| 7231 | + https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/range-cell-control.yaml |
| 7232 | + |
| 7233 | + |
| 7234 | + // Add checkboxes to the table. |
| 7235 | + |
| 7236 | + await Excel.run(async (context) => { |
| 7237 | + const sheet = context.workbook.worksheets.getActiveWorksheet(); |
| 7238 | + |
| 7239 | + // Get the second column in the table, without the header. |
| 7240 | + const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange(); |
| 7241 | + |
| 7242 | + // Change the boolean values to checkboxes. |
| 7243 | + range.control = { |
| 7244 | + type: Excel.CellControlType.checkbox |
| 7245 | + }; |
| 7246 | + await context.sync(); |
| 7247 | + }); |
| 7248 | +'Excel.TableColumnCollection:class': |
| 7249 | + - >- |
| 7250 | + // Link to full sample: |
| 7251 | + https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/range-cell-control.yaml |
| 7252 | + |
| 7253 | + |
| 7254 | + // Add checkboxes to the table. |
| 7255 | + |
| 7256 | + await Excel.run(async (context) => { |
| 7257 | + const sheet = context.workbook.worksheets.getActiveWorksheet(); |
| 7258 | + |
| 7259 | + // Get the second column in the table, without the header. |
| 7260 | + const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange(); |
| 7261 | + |
| 7262 | + // Change the boolean values to checkboxes. |
| 7263 | + range.control = { |
| 7264 | + type: Excel.CellControlType.checkbox |
| 7265 | + }; |
| 7266 | + await context.sync(); |
| 7267 | + }); |
| 7268 | +'Excel.TableColumnCollection#getItem:member(1)': |
| 7269 | + - >- |
| 7270 | + // Link to full sample: |
| 7271 | + https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/range-cell-control.yaml |
| 7272 | + |
| 7273 | + |
| 7274 | + // Remove all content from the Analysis column. |
| 7275 | + |
| 7276 | + await Excel.run(async (context) => { |
| 7277 | + const sheet = context.workbook.worksheets.getActiveWorksheet(); |
| 7278 | + |
| 7279 | + // Get the second column in the table, without the header. |
| 7280 | + const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange(); |
| 7281 | + |
| 7282 | + // Clear all the data from the second column. |
| 7283 | + range.clearOrResetContents(); |
| 7284 | + await context.sync(); |
| 7285 | + }); |
7208 | 7286 | 'Excel.TableSelectionChangedEventArgs#address:member':
|
7209 | 7287 | - >-
|
7210 | 7288 | // Link to full sample:
|
|
0 commit comments