ExcelScript.CustomConditionalFormat interface
カスタムの条件付き書式の種類を表します。
注釈
例
/**
* This script applies a custom three-color conditional formatting to the selected range.
* The three colors represent positive, negative, or no changes from the values in the previous column.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the selected cells.
let selectedRange = workbook.getSelectedRange();
// Apply a rule for positive change from the previous column.
let positiveChange = selectedRange.addConditionalFormat(ExcelScript.ConditionalFormatType.custom);
positiveChange.getCustom().getFormat().getFill().setColor("lightgreen");
positiveChange.getCustom().getRule().setFormula(`=${selectedRange.getCell(0, 0).getAddress()}>${selectedRange.getOffsetRange(0, -1).getCell(0, 0).getAddress()}`);
// Apply a rule for negative change from the previous column.
let negativeChange = selectedRange.addConditionalFormat(ExcelScript.ConditionalFormatType.custom);
negativeChange.getCustom().getFormat().getFill().setColor("pink");
negativeChange.getCustom().getRule().setFormula(`=${selectedRange.getCell(0, 0).getAddress()}<${selectedRange.getOffsetRange(0, -1).getCell(0, 0).getAddress()}`);
// Apply a rule for no change from the previous column.
let noChange = selectedRange.addConditionalFormat(ExcelScript.ConditionalFormatType.custom);
noChange.getCustom().getFormat().getFill().setColor("lightyellow");
noChange.getCustom().getRule().setFormula(`=${selectedRange.getCell(0, 0).getAddress()}=${selectedRange.getOffsetRange(0, -1).getCell(0, 0).getAddress()}`);
}
メソッド
get |
条件付き書式フォント、塗りつぶし、罫線、およびその他のプロパティをカプセル化して、書式オブジェクトを返します。 |
get |
この条件付き形式で |
メソッドの詳細
getFormat()
条件付き書式フォント、塗りつぶし、罫線、およびその他のプロパティをカプセル化して、書式オブジェクトを返します。
getFormat(): ConditionalRangeFormat;
戻り値
getRule()
この条件付き形式で Rule
オブジェクトを指定します。
getRule(): ConditionalFormatRule;
戻り値
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
Office Scripts
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示