存取 ConditionalFormatRuleApis
中的漸層 (顏色) 條件。每項條件式格式規則可包含單一漸層條件。梯度條件是由數尺度 (最小值、中位數和最大值) 的三個點定義,每個點都有顏色、值和 InterpolationType
。系統會比較儲存格內容與數字比例的值,套用至儲存格的顏色則會根據儲存格內容與漸層條件最小、中點及最大點的距離進行內插。
// Logs all the information inside gradient conditional format rules on a sheet. // The below snippet assumes all colors have ColorType.RGB. var sheet = SpreadsheetApp.getActiveSheet(); var rules = sheet.getConditionalFormatRules(); for (int i = 0; i < rules.length; i++) { var gradient = rules[i].getGradientCondition(); Logger.log("The conditional format gradient information for rule %d:\n MinColor %s, MinType %s, MinValue %s, \n MidColor %s, MidType %s, MidValue %s, \n MaxColor %s, MaxType %s, MaxValue %s \n", i, gradient.getMinColorObject().asRgbColor().asHexString(), gradient.getMinType(), gradient.getMinValue(), gradient.getMidColorObject().asRgbColor().asHexString(), gradient.getMidType(), gradient.getMidValue(), gradient.getMaxColorObject().asRgbColor().asHexString(), gradient.getMaxType(), gradient.getMaxValue()); }
方法
方法 | 傳回類型 | 簡短說明 |
---|---|---|
getMaxColorObject() | Color | 取得此漸層條件最大值的顏色集。 |
getMaxType() | InterpolationType | 取得此漸層條件最大值的內插類型。 |
getMaxValue() | String | 取得這個漸層條件的最大值。 |
getMidColorObject() | Color | 取得這個漸層條件中點值的顏色設定。 |
getMidType() | InterpolationType | 取得此漸層條件的中點值的內插類型。 |
getMidValue() | String | 取得這個漸層條件的中點值。 |
getMinColorObject() | Color | 取得這個漸層條件的最小值設定顏色。 |
getMinType() | InterpolationType | 取得此漸層條件的最小值的內插類型。 |
getMinValue() | String | 取得此漸層條件的最小值。 |
內容詳盡的說明文件
getMaxColorObject()
getMaxType()
getMaxValue()
getMidColorObject()
getMidType()
getMidValue()
取得這個漸層條件的中點值。如果尚未設定漸層中間值,則傳回空字串。
回攻員
String
:中點值或空白字串