Excel.ConditionalIconCriterion interface
アイコン セットを使用しない場合は、型、値、演算子、およびオプションのカスタム アイコンを含むアイコン条件を表します。
注釈
プロパティ
custom |
現在の条件のカスタム アイコン (既定のアイコン セットと異なる場合)、それ以外の場合は |
formula | 種類によっては数値または数式。 |
operator |
|
type | アイコンの条件式は次のものに基づいています。 |
プロパティの詳細
customIcon
現在の条件のカスタム アイコン (既定のアイコン セットと異なる場合)、それ以外の場合は null
が返されます。
customIcon?: Excel.Icon;
プロパティ値
注釈
formula
種類によっては数値または数式。
formula: string;
プロパティ値
string
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/14-conditional-formatting/conditional-formatting-basic.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
const range = sheet.getRange("B8:E13");
const conditionalFormat = range.conditionalFormats
.add(Excel.ConditionalFormatType.iconSet);
const iconSetCF = conditionalFormat.iconSet;
iconSetCF.style = Excel.IconSet.threeTriangles;
/*
The iconSetCF.criteria array is automatically prepopulated with
criterion elements whose properties have been given default settings.
You can't write to each property of a criterion directly. Instead,
replace the whole criteria object.
With a "three*" icon set style, such as "threeTriangles", the third
element in the criteria array (criteria[2]) defines the "top" icon;
e.g., a green triangle. The second (criteria[1]) defines the "middle"
icon. The first (criteria[0]) defines the "low" icon, but it
can often be left empty as the following object shows, because every
cell that does not match the other two criteria always gets the low
icon.
*/
iconSetCF.criteria = [
{} as any,
{
type: Excel.ConditionalFormatIconRuleType.number,
operator: Excel.ConditionalIconCriterionOperator.greaterThanOrEqual,
formula: "=700"
},
{
type: Excel.ConditionalFormatIconRuleType.number,
operator: Excel.ConditionalIconCriterionOperator.greaterThanOrEqual,
formula: "=1000",
}
];
await context.sync();
});
operator
greaterThan
または、アイコンの条件付き形式の各ルールの種類に対して greaterThanOrEqual
します。
operator: Excel.ConditionalIconCriterionOperator | "Invalid" | "GreaterThan" | "GreaterThanOrEqual";
プロパティ値
Excel.ConditionalIconCriterionOperator | "Invalid" | "GreaterThan" | "GreaterThanOrEqual"
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/14-conditional-formatting/conditional-formatting-basic.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
const range = sheet.getRange("B8:E13");
const conditionalFormat = range.conditionalFormats
.add(Excel.ConditionalFormatType.iconSet);
const iconSetCF = conditionalFormat.iconSet;
iconSetCF.style = Excel.IconSet.threeTriangles;
/*
The iconSetCF.criteria array is automatically prepopulated with
criterion elements whose properties have been given default settings.
You can't write to each property of a criterion directly. Instead,
replace the whole criteria object.
With a "three*" icon set style, such as "threeTriangles", the third
element in the criteria array (criteria[2]) defines the "top" icon;
e.g., a green triangle. The second (criteria[1]) defines the "middle"
icon. The first (criteria[0]) defines the "low" icon, but it
can often be left empty as the following object shows, because every
cell that does not match the other two criteria always gets the low
icon.
*/
iconSetCF.criteria = [
{} as any,
{
type: Excel.ConditionalFormatIconRuleType.number,
operator: Excel.ConditionalIconCriterionOperator.greaterThanOrEqual,
formula: "=700"
},
{
type: Excel.ConditionalFormatIconRuleType.number,
operator: Excel.ConditionalIconCriterionOperator.greaterThanOrEqual,
formula: "=1000",
}
];
await context.sync();
});
type
アイコンの条件式は次のものに基づいています。
type: Excel.ConditionalFormatIconRuleType | "Invalid" | "Number" | "Percent" | "Formula" | "Percentile";
プロパティ値
Excel.ConditionalFormatIconRuleType | "Invalid" | "Number" | "Percent" | "Formula" | "Percentile"
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/14-conditional-formatting/conditional-formatting-basic.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
const range = sheet.getRange("B8:E13");
const conditionalFormat = range.conditionalFormats
.add(Excel.ConditionalFormatType.iconSet);
const iconSetCF = conditionalFormat.iconSet;
iconSetCF.style = Excel.IconSet.threeTriangles;
/*
The iconSetCF.criteria array is automatically prepopulated with
criterion elements whose properties have been given default settings.
You can't write to each property of a criterion directly. Instead,
replace the whole criteria object.
With a "three*" icon set style, such as "threeTriangles", the third
element in the criteria array (criteria[2]) defines the "top" icon;
e.g., a green triangle. The second (criteria[1]) defines the "middle"
icon. The first (criteria[0]) defines the "low" icon, but it
can often be left empty as the following object shows, because every
cell that does not match the other two criteria always gets the low
icon.
*/
iconSetCF.criteria = [
{} as any,
{
type: Excel.ConditionalFormatIconRuleType.number,
operator: Excel.ConditionalIconCriterionOperator.greaterThanOrEqual,
formula: "=700"
},
{
type: Excel.ConditionalFormatIconRuleType.number,
operator: Excel.ConditionalIconCriterionOperator.greaterThanOrEqual,
formula: "=1000",
}
];
await context.sync();
});
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
Office Add-ins