Skip to content

Commit 5050075

Browse files
committed
Incorporate code review feedback, re-run yarn start
1 parent 6aba60c commit 5050075

File tree

3 files changed

+113
-35
lines changed

3 files changed

+113
-35
lines changed

samples/excel/42-range/range-cell-control.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ script:
1818
await Excel.run(async (context) => {
1919
const sheet = context.workbook.worksheets.getActiveWorksheet();
2020
21-
// Get the second column in the table.
21+
// Get the second column in the table, without the header.
2222
const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange();
2323
2424
// Change the boolean values to checkboxes.
@@ -45,8 +45,8 @@ script:
4545
await Excel.run(async (context) => {
4646
const sheet = context.workbook.worksheets.getActiveWorksheet();
4747
48-
// Get the second column in the table.
49-
const range = sheet.getRange("FruitTable").getColumn(1);
48+
// Get the second column in the table, without the header.
49+
const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange();
5050
5151
// Change the checkboxes back to boolean values.
5252
range.control = {
@@ -61,8 +61,8 @@ script:
6161
await Excel.run(async (context) => {
6262
const sheet = context.workbook.worksheets.getActiveWorksheet();
6363
64-
// Get the second column in the table.
65-
const range = sheet.getRange("FruitTable").getColumn(1);
64+
// Get the second column in the table, without the header.
65+
const range = sheet.tables.getItem("FruitTable").columns.getItem("Analysis").getDataBodyRange();
6666
6767
// Clear all the data from the second column.
6868
range.clearOrResetContents();

snippet-extractor-metadata/excel.xlsx

131 Bytes
Binary file not shown.

snippet-extractor-output/snippets.yaml

+108-30
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@
456456
await Excel.run(async (context) => {
457457
const sheet = context.workbook.worksheets.getActiveWorksheet();
458458

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();
461461

462462
// Change the boolean values to checkboxes.
463463
range.control = {
@@ -476,8 +476,8 @@
476476
await Excel.run(async (context) => {
477477
const sheet = context.workbook.worksheets.getActiveWorksheet();
478478

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();
481481

482482
// Change the boolean values to checkboxes.
483483
range.control = {
@@ -1722,8 +1722,8 @@
17221722
await Excel.run(async (context) => {
17231723
const sheet = context.workbook.worksheets.getActiveWorksheet();
17241724

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();
17271727

17281728
// Change the boolean values to checkboxes.
17291729
range.control = {
@@ -5127,8 +5127,8 @@
51275127
await Excel.run(async (context) => {
51285128
const sheet = context.workbook.worksheets.getActiveWorksheet();
51295129

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();
51325132

51335133
// Clear all the data from the second column.
51345134
range.clearOrResetContents();
@@ -5161,8 +5161,8 @@
51615161
await Excel.run(async (context) => {
51625162
const sheet = context.workbook.worksheets.getActiveWorksheet();
51635163

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();
51665166

51675167
// Change the boolean values to checkboxes.
51685168
range.control = {
@@ -5251,26 +5251,6 @@
52515251
console.log(
52525252
`Address: ${cellProperties.address}\nStyle: ${cellProperties.style}\nFill Color: ${cellProperties.format.fill.color}\nFont Color: ${cellProperties.format.font.color}`);
52535253
});
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-
});
52745254
'Excel.Range#getDependents:member(1)':
52755255
- >-
52765256
// Link to full sample:
@@ -7192,6 +7172,46 @@
71927172
console.log("Worksheet Id : " + worksheet.name);
71937173
});
71947174
}
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+
});
71957215
'Excel.TableCollection#onChanged:member':
71967216
- >-
71977217
// Link to full sample:
@@ -7205,6 +7225,64 @@
72057225
await context.sync();
72067226
console.log("A handler has been registered for the table collection onChanged event");
72077227
});
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+
});
72087286
'Excel.TableSelectionChangedEventArgs#address:member':
72097287
- >-
72107288
// Link to full sample:

0 commit comments

Comments
 (0)