Skip to content

Commit 33c35d8

Browse files
author
github-actions
committed
Merge branch 'main' into live
2 parents 5c04f76 + d4e3162 commit 33c35d8

File tree

251 files changed

+6778
-416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+6778
-416
lines changed

docs/docs-ref-autogen/excel/excel/excel.cardlayoutsection.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,80 @@ remarks: >-
99
1.16](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1010
1111
12+
13+
1214
Learn more about the types in this type alias through the following links.
1315
1416
1517
[Excel.CardLayoutListSection](/javascript/api/excel/excel.cardlayoutlistsection),
1618
[Excel.CardLayoutTableSection](/javascript/api/excel/excel.cardlayouttablesection),
1719
[Excel.CardLayoutTwoColumnSection](/javascript/api/excel/excel.cardlayouttwocolumnsection)
1820
21+
22+
#### Examples
23+
24+
25+
```TypeScript
26+
27+
// Link to full sample:
28+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-entity-attribution.yaml
29+
30+
31+
function makeProductEntity(productID: number, productName: string, product?:
32+
any) {
33+
const entity: Excel.EntityCellValue = {
34+
type: Excel.CellValueType.entity,
35+
text: productName,
36+
properties: { /* Excel.EntityPropertyType */
37+
"Product ID": {
38+
type: Excel.CellValueType.string,
39+
basicValue: productID.toString() || ""
40+
},
41+
"Product Name": {
42+
type: Excel.CellValueType.string,
43+
basicValue: productName || ""
44+
},
45+
"Quantity Per Unit": {
46+
type: Excel.CellValueType.string,
47+
basicValue: product.quantityPerUnit || ""
48+
},
49+
// Add Unit Price as a formatted number.
50+
"Unit Price": {
51+
type: Excel.CellValueType.formattedNumber,
52+
basicValue: product.unitPrice,
53+
numberFormat: "$* #,##0.00"
54+
}
55+
},
56+
layouts: { /* Excel.EntityViewLayouts */
57+
card: { /* Excel.EntityCardLayout */
58+
title: { property: "Product Name" },
59+
sections: [ /* Excel.CardLayoutSection */
60+
{
61+
layout: "List",
62+
properties: ["Product ID"]
63+
},
64+
{
65+
layout: "List",
66+
title: "Quantity and price",
67+
collapsible: true,
68+
collapsed: false,
69+
properties: ["Quantity Per Unit", "Unit Price"]
70+
}
71+
]
72+
}
73+
},
74+
provider: {
75+
description: product.providerName, // Name of the data provider. Displays as a tooltip when hovering over the logo. Also displays as a fallback if the source address for the image is broken.
76+
logoSourceAddress: product.sourceAddress, // Source URL of the logo to display.
77+
logoTargetAddress: product.targetAddress // Destination URL that the logo navigates to when clicked.
78+
}
79+
};
80+
81+
return entity;
82+
}
83+
84+
```
85+
1986
isPreview: false
2087
isDeprecated: false
2188
syntax: >-

docs/docs-ref-autogen/excel/excel/excel.cellborder.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,90 @@ remarks: >-
1313
\[ [API set: ExcelApi
1414
1.9](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1515
16+
17+
#### Examples
18+
19+
20+
```TypeScript
21+
22+
// Link to full sample:
23+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/cell-properties.yaml
24+
25+
26+
await Excel.run(async (context) => {
27+
const sheet = context.workbook.worksheets.getActiveWorksheet();
28+
29+
// Creating the SettableCellProperties objects to use for the range.
30+
// In your add-in, these should be created once, outside the function.
31+
const topHeaderProps: Excel.SettableCellProperties = {
32+
// The style property takes a string matching the name of an Excel style.
33+
// Built-in style names are listed in the `BuiltInStyle` enum.
34+
// Note that a style will overwrite any formatting,
35+
// so do not use the format property with the style property.
36+
style: "Heading1"
37+
};
38+
39+
const headerProps: Excel.SettableCellProperties = {
40+
// Any subproperties of format that are not set will not be changed when these cell properties are set.
41+
format: {
42+
fill: {
43+
color: "Blue"
44+
},
45+
font: {
46+
color: "White",
47+
bold: true
48+
}
49+
}
50+
};
51+
52+
const nonApplicableProps: Excel.SettableCellProperties = {
53+
format: {
54+
fill: {
55+
pattern: Excel.FillPattern.gray25
56+
},
57+
font: {
58+
color: "Gray",
59+
italic: true
60+
}
61+
}
62+
};
63+
64+
const matchupScoreProps: Excel.SettableCellProperties = {
65+
format: {
66+
borders: {
67+
bottom: {
68+
style: Excel.BorderLineStyle.continuous
69+
},
70+
left: {
71+
style: Excel.BorderLineStyle.continuous
72+
},
73+
right: {
74+
style: Excel.BorderLineStyle.continuous
75+
},
76+
top: {
77+
style: Excel.BorderLineStyle.continuous
78+
}
79+
}
80+
}
81+
};
82+
83+
const range = sheet.getRange("A1:E5");
84+
85+
// You can use empty JSON objects to avoid changing a cell's properties.
86+
range.setCellProperties([
87+
[topHeaderProps, {}, {}, {}, {}],
88+
[{}, {}, headerProps, headerProps, headerProps],
89+
[{}, headerProps, nonApplicableProps, matchupScoreProps, matchupScoreProps],
90+
[{}, headerProps, matchupScoreProps, nonApplicableProps, matchupScoreProps],
91+
[{}, headerProps, matchupScoreProps, matchupScoreProps, nonApplicableProps]
92+
]);
93+
94+
sheet.getUsedRange().format.autofitColumns();
95+
await context.sync();
96+
});
97+
98+
```
99+
16100
isPreview: false
17101
isDeprecated: false
18102
type: interface

docs/docs-ref-autogen/excel/excel/excel.datavalidationerroralert.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,50 @@ remarks: >-
88
\[ [API set: ExcelApi
99
1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1010
11+
12+
#### Examples
13+
14+
15+
```TypeScript
16+
17+
// Link to full sample:
18+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/22-data-validation/data-validation.yaml
19+
20+
21+
await Excel.run(async (context) => {
22+
const sheet = context.workbook.worksheets.getItem("Decision");
23+
const rankingRange = sheet.tables.getItem("NameOptionsTable").columns.getItem("Ranking").getDataBodyRange();
24+
25+
// When you are developing, it is a good practice to
26+
// clear the dataValidation object with each run of your code.
27+
rankingRange.dataValidation.clear();
28+
29+
let greaterThanZeroRule = {
30+
wholeNumber: {
31+
formula1: 0,
32+
operator: Excel.DataValidationOperator.greaterThan
33+
}
34+
};
35+
rankingRange.dataValidation.rule = greaterThanZeroRule;
36+
37+
rankingRange.dataValidation.prompt = {
38+
message: "Please enter a positive number.",
39+
showPrompt: true,
40+
title: "Positive numbers only."
41+
};
42+
43+
rankingRange.dataValidation.errorAlert = {
44+
message: "Sorry, only positive numbers are allowed",
45+
showAlert: true,
46+
style: "Stop",
47+
title: "Negative Number Entered"
48+
};
49+
50+
await context.sync();
51+
});
52+
53+
```
54+
1155
isPreview: false
1256
isDeprecated: false
1357
type: interface

docs/docs-ref-autogen/excel/excel/excel.entitycardlayout.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,71 @@ remarks: >-
88
\[ [API set: ExcelApi
99
1.16](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1010
11+
12+
#### Examples
13+
14+
15+
```TypeScript
16+
17+
// Link to full sample:
18+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-entity-attribution.yaml
19+
20+
21+
function makeProductEntity(productID: number, productName: string, product?:
22+
any) {
23+
const entity: Excel.EntityCellValue = {
24+
type: Excel.CellValueType.entity,
25+
text: productName,
26+
properties: { /* Excel.EntityPropertyType */
27+
"Product ID": {
28+
type: Excel.CellValueType.string,
29+
basicValue: productID.toString() || ""
30+
},
31+
"Product Name": {
32+
type: Excel.CellValueType.string,
33+
basicValue: productName || ""
34+
},
35+
"Quantity Per Unit": {
36+
type: Excel.CellValueType.string,
37+
basicValue: product.quantityPerUnit || ""
38+
},
39+
// Add Unit Price as a formatted number.
40+
"Unit Price": {
41+
type: Excel.CellValueType.formattedNumber,
42+
basicValue: product.unitPrice,
43+
numberFormat: "$* #,##0.00"
44+
}
45+
},
46+
layouts: { /* Excel.EntityViewLayouts */
47+
card: { /* Excel.EntityCardLayout */
48+
title: { property: "Product Name" },
49+
sections: [ /* Excel.CardLayoutSection */
50+
{
51+
layout: "List",
52+
properties: ["Product ID"]
53+
},
54+
{
55+
layout: "List",
56+
title: "Quantity and price",
57+
collapsible: true,
58+
collapsed: false,
59+
properties: ["Quantity Per Unit", "Unit Price"]
60+
}
61+
]
62+
}
63+
},
64+
provider: {
65+
description: product.providerName, // Name of the data provider. Displays as a tooltip when hovering over the logo. Also displays as a fallback if the source address for the image is broken.
66+
logoSourceAddress: product.sourceAddress, // Source URL of the logo to display.
67+
logoTargetAddress: product.targetAddress // Destination URL that the logo navigates to when clicked.
68+
}
69+
};
70+
71+
return entity;
72+
}
73+
74+
```
75+
1176
isPreview: false
1277
isDeprecated: false
1378
type: interface

docs/docs-ref-autogen/excel/excel/excel.entitypropertytype.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,79 @@ remarks: >-
99
1.16](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
1010
1111
12+
13+
1214
Learn more about the types in this type alias through the following links.
1315
1416
1517
[Excel.CellValueAndPropertyMetadata](/javascript/api/excel/excel.cellvalueandpropertymetadata),
1618
[Excel.CellValue](/javascript/api/excel/excel.cellvalue)
1719
20+
21+
#### Examples
22+
23+
24+
```TypeScript
25+
26+
// Link to full sample:
27+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-entity-attribution.yaml
28+
29+
30+
function makeProductEntity(productID: number, productName: string, product?:
31+
any) {
32+
const entity: Excel.EntityCellValue = {
33+
type: Excel.CellValueType.entity,
34+
text: productName,
35+
properties: { /* Excel.EntityPropertyType */
36+
"Product ID": {
37+
type: Excel.CellValueType.string,
38+
basicValue: productID.toString() || ""
39+
},
40+
"Product Name": {
41+
type: Excel.CellValueType.string,
42+
basicValue: productName || ""
43+
},
44+
"Quantity Per Unit": {
45+
type: Excel.CellValueType.string,
46+
basicValue: product.quantityPerUnit || ""
47+
},
48+
// Add Unit Price as a formatted number.
49+
"Unit Price": {
50+
type: Excel.CellValueType.formattedNumber,
51+
basicValue: product.unitPrice,
52+
numberFormat: "$* #,##0.00"
53+
}
54+
},
55+
layouts: { /* Excel.EntityViewLayouts */
56+
card: { /* Excel.EntityCardLayout */
57+
title: { property: "Product Name" },
58+
sections: [ /* Excel.CardLayoutSection */
59+
{
60+
layout: "List",
61+
properties: ["Product ID"]
62+
},
63+
{
64+
layout: "List",
65+
title: "Quantity and price",
66+
collapsible: true,
67+
collapsed: false,
68+
properties: ["Quantity Per Unit", "Unit Price"]
69+
}
70+
]
71+
}
72+
},
73+
provider: {
74+
description: product.providerName, // Name of the data provider. Displays as a tooltip when hovering over the logo. Also displays as a fallback if the source address for the image is broken.
75+
logoSourceAddress: product.sourceAddress, // Source URL of the logo to display.
76+
logoTargetAddress: product.targetAddress // Destination URL that the logo navigates to when clicked.
77+
}
78+
};
79+
80+
return entity;
81+
}
82+
83+
```
84+
1885
isPreview: false
1986
isDeprecated: false
2087
syntax: export type EntityPropertyType = CellValueAndPropertyMetadata | CellValue;

0 commit comments

Comments
 (0)