Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions docs/docs-ref-autogen/excel/excel/excel.cardlayoutsection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,80 @@ remarks: >-
1.16](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]




Learn more about the types in this type alias through the following links.


[Excel.CardLayoutListSection](/javascript/api/excel/excel.cardlayoutlistsection),
[Excel.CardLayoutTableSection](/javascript/api/excel/excel.cardlayouttablesection),
[Excel.CardLayoutTwoColumnSection](/javascript/api/excel/excel.cardlayouttwocolumnsection)


#### Examples


```TypeScript

// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-entity-attribution.yaml


function makeProductEntity(productID: number, productName: string, product?:
any) {
const entity: Excel.EntityCellValue = {
type: Excel.CellValueType.entity,
text: productName,
properties: { /* Excel.EntityPropertyType */
"Product ID": {
type: Excel.CellValueType.string,
basicValue: productID.toString() || ""
},
"Product Name": {
type: Excel.CellValueType.string,
basicValue: productName || ""
},
"Quantity Per Unit": {
type: Excel.CellValueType.string,
basicValue: product.quantityPerUnit || ""
},
// Add Unit Price as a formatted number.
"Unit Price": {
type: Excel.CellValueType.formattedNumber,
basicValue: product.unitPrice,
numberFormat: "$* #,##0.00"
}
},
layouts: { /* Excel.EntityViewLayouts */
card: { /* Excel.EntityCardLayout */
title: { property: "Product Name" },
sections: [ /* Excel.CardLayoutSection */
{
layout: "List",
properties: ["Product ID"]
},
{
layout: "List",
title: "Quantity and price",
collapsible: true,
collapsed: false,
properties: ["Quantity Per Unit", "Unit Price"]
}
]
}
},
provider: {
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.
logoSourceAddress: product.sourceAddress, // Source URL of the logo to display.
logoTargetAddress: product.targetAddress // Destination URL that the logo navigates to when clicked.
}
};

return entity;
}

```

isPreview: false
isDeprecated: false
syntax: >-
Expand Down
84 changes: 84 additions & 0 deletions docs/docs-ref-autogen/excel/excel/excel.cellborder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,90 @@ remarks: >-
\[ [API set: ExcelApi
1.9](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]


#### Examples


```TypeScript

// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/cell-properties.yaml


await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getActiveWorksheet();

// Creating the SettableCellProperties objects to use for the range.
// In your add-in, these should be created once, outside the function.
const topHeaderProps: Excel.SettableCellProperties = {
// The style property takes a string matching the name of an Excel style.
// Built-in style names are listed in the `BuiltInStyle` enum.
// Note that a style will overwrite any formatting,
// so do not use the format property with the style property.
style: "Heading1"
};

const headerProps: Excel.SettableCellProperties = {
// Any subproperties of format that are not set will not be changed when these cell properties are set.
format: {
fill: {
color: "Blue"
},
font: {
color: "White",
bold: true
}
}
};

const nonApplicableProps: Excel.SettableCellProperties = {
format: {
fill: {
pattern: Excel.FillPattern.gray25
},
font: {
color: "Gray",
italic: true
}
}
};

const matchupScoreProps: Excel.SettableCellProperties = {
format: {
borders: {
bottom: {
style: Excel.BorderLineStyle.continuous
},
left: {
style: Excel.BorderLineStyle.continuous
},
right: {
style: Excel.BorderLineStyle.continuous
},
top: {
style: Excel.BorderLineStyle.continuous
}
}
}
};

const range = sheet.getRange("A1:E5");

// You can use empty JSON objects to avoid changing a cell's properties.
range.setCellProperties([
[topHeaderProps, {}, {}, {}, {}],
[{}, {}, headerProps, headerProps, headerProps],
[{}, headerProps, nonApplicableProps, matchupScoreProps, matchupScoreProps],
[{}, headerProps, matchupScoreProps, nonApplicableProps, matchupScoreProps],
[{}, headerProps, matchupScoreProps, matchupScoreProps, nonApplicableProps]
]);

sheet.getUsedRange().format.autofitColumns();
await context.sync();
});

```

isPreview: false
isDeprecated: false
type: interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,50 @@ remarks: >-
\[ [API set: ExcelApi
1.8](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]


#### Examples


```TypeScript

// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/22-data-validation/data-validation.yaml


await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Decision");
const rankingRange = sheet.tables.getItem("NameOptionsTable").columns.getItem("Ranking").getDataBodyRange();

// When you are developing, it is a good practice to
// clear the dataValidation object with each run of your code.
rankingRange.dataValidation.clear();

let greaterThanZeroRule = {
wholeNumber: {
formula1: 0,
operator: Excel.DataValidationOperator.greaterThan
}
};
rankingRange.dataValidation.rule = greaterThanZeroRule;

rankingRange.dataValidation.prompt = {
message: "Please enter a positive number.",
showPrompt: true,
title: "Positive numbers only."
};

rankingRange.dataValidation.errorAlert = {
message: "Sorry, only positive numbers are allowed",
showAlert: true,
style: "Stop",
title: "Negative Number Entered"
};

await context.sync();
});

```

isPreview: false
isDeprecated: false
type: interface
Expand Down
65 changes: 65 additions & 0 deletions docs/docs-ref-autogen/excel/excel/excel.entitycardlayout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,71 @@ remarks: >-
\[ [API set: ExcelApi
1.16](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]


#### Examples


```TypeScript

// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-entity-attribution.yaml


function makeProductEntity(productID: number, productName: string, product?:
any) {
const entity: Excel.EntityCellValue = {
type: Excel.CellValueType.entity,
text: productName,
properties: { /* Excel.EntityPropertyType */
"Product ID": {
type: Excel.CellValueType.string,
basicValue: productID.toString() || ""
},
"Product Name": {
type: Excel.CellValueType.string,
basicValue: productName || ""
},
"Quantity Per Unit": {
type: Excel.CellValueType.string,
basicValue: product.quantityPerUnit || ""
},
// Add Unit Price as a formatted number.
"Unit Price": {
type: Excel.CellValueType.formattedNumber,
basicValue: product.unitPrice,
numberFormat: "$* #,##0.00"
}
},
layouts: { /* Excel.EntityViewLayouts */
card: { /* Excel.EntityCardLayout */
title: { property: "Product Name" },
sections: [ /* Excel.CardLayoutSection */
{
layout: "List",
properties: ["Product ID"]
},
{
layout: "List",
title: "Quantity and price",
collapsible: true,
collapsed: false,
properties: ["Quantity Per Unit", "Unit Price"]
}
]
}
},
provider: {
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.
logoSourceAddress: product.sourceAddress, // Source URL of the logo to display.
logoTargetAddress: product.targetAddress // Destination URL that the logo navigates to when clicked.
}
};

return entity;
}

```

isPreview: false
isDeprecated: false
type: interface
Expand Down
67 changes: 67 additions & 0 deletions docs/docs-ref-autogen/excel/excel/excel.entitypropertytype.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,79 @@ remarks: >-
1.16](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]




Learn more about the types in this type alias through the following links.


[Excel.CellValueAndPropertyMetadata](/javascript/api/excel/excel.cellvalueandpropertymetadata),
[Excel.CellValue](/javascript/api/excel/excel.cellvalue)


#### Examples


```TypeScript

// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-entity-attribution.yaml


function makeProductEntity(productID: number, productName: string, product?:
any) {
const entity: Excel.EntityCellValue = {
type: Excel.CellValueType.entity,
text: productName,
properties: { /* Excel.EntityPropertyType */
"Product ID": {
type: Excel.CellValueType.string,
basicValue: productID.toString() || ""
},
"Product Name": {
type: Excel.CellValueType.string,
basicValue: productName || ""
},
"Quantity Per Unit": {
type: Excel.CellValueType.string,
basicValue: product.quantityPerUnit || ""
},
// Add Unit Price as a formatted number.
"Unit Price": {
type: Excel.CellValueType.formattedNumber,
basicValue: product.unitPrice,
numberFormat: "$* #,##0.00"
}
},
layouts: { /* Excel.EntityViewLayouts */
card: { /* Excel.EntityCardLayout */
title: { property: "Product Name" },
sections: [ /* Excel.CardLayoutSection */
{
layout: "List",
properties: ["Product ID"]
},
{
layout: "List",
title: "Quantity and price",
collapsible: true,
collapsed: false,
properties: ["Quantity Per Unit", "Unit Price"]
}
]
}
},
provider: {
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.
logoSourceAddress: product.sourceAddress, // Source URL of the logo to display.
logoTargetAddress: product.targetAddress // Destination URL that the logo navigates to when clicked.
}
};

return entity;
}

```

isPreview: false
isDeprecated: false
syntax: export type EntityPropertyType = CellValueAndPropertyMetadata | CellValue;
Loading