Back to Devexpress

ConditionalFormattingCollection.CreateValue(ConditionalFormattingValueType, String) Method

officefileapi-devexpress-dot-spreadsheet-dot-conditionalformattingcollection-dot-createvalue-x28-devexpress-dot-spreadsheet-dot-conditionalformattingvaluetype-system-dot-string-x29.md

latest7.5 KB
Original Source

ConditionalFormattingCollection.CreateValue(ConditionalFormattingValueType, String) Method

Specifies the minimum or maximum threshold value for the conditional formatting rule.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
ConditionalFormattingValue CreateValue(
    ConditionalFormattingValueType valueType,
    string value
)
vb
Function CreateValue(
    valueType As ConditionalFormattingValueType,
    value As String
) As ConditionalFormattingValue

Parameters

NameTypeDescription
valueTypeConditionalFormattingValueType

One of the ConditionalFormattingValueType enumeration values.

| | value | String |

A string that is the threshold value.

|

Returns

TypeDescription
ConditionalFormattingValue

The ConditionalFormattingValue object that defines the threshold value and its ConditionalFormattingValueType type.

|

Remarks

If you use a formula to determine the threshold value (the valueType is set to ConditionalFormattingValueType.Formula), start it with an equals sign (=). The formula can include built-in spreadsheet functions. Note that use of relative references is not allowed.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateValue(ConditionalFormattingValueType, String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

spreadsheet-document-api-apply-conditional-formatting-to-cell-range/CS/ConditionalFormatting_Example/SpreadsheetActions/ConditionalFormatting.cs#L292

csharp
// Set the minimum threshold to the lowest value in the range of cells using the MIN() formula.
ConditionalFormattingValue minPoint = conditionalFormattings.CreateValue(ConditionalFormattingValueType.Formula, "=MIN($C$2:$D$15)");
// Set the midpoint threshold to the 50th percentile.

winforms-spreadsheet-apply-conditional-formatting-to-a-range-of-cells/CS/SpreadsheetControl/SpreadsheetActions/ConditionalFormatting.cs#L290

csharp
// Set the minimum threshold to the lowest value in the range of cells using the MIN() formula.
ConditionalFormattingValue minPoint = conditionalFormattings.CreateValue(ConditionalFormattingValueType.Formula, "=MIN($C$2:$D$15)");
// Set the midpoint threshold to the 50th percentile.

wpf-spreadsheet-how-to-apply-conditional-formatting-to-a-range-of-cells/CS/ConditionalFormatting_WPF_Examples/SpreadsheetActions/ConditionalFormatting.cs#L288

csharp
// Set the minimum threshold to the lowest value in the range of cells using the MIN() formula.
ConditionalFormattingValue minPoint = conditionalFormattings.CreateValue(ConditionalFormattingValueType.Formula, "=MIN($C$2:$D$15)");
// Set the midpoint threshold to the 50th percentile.

spreadsheet-document-api-apply-conditional-formatting-to-cell-range/VB/ConditionalFormatting_Example/SpreadsheetActions/ConditionalFormatting.vb#L254

vb
' Set the minimum threshold to the lowest value in the range of cells using the MIN() formula.
Dim minPoint As ConditionalFormattingValue = conditionalFormattings.CreateValue(ConditionalFormattingValueType.Formula, "=MIN($C$2:$D$15)")
' Set the midpoint threshold to the 50th percentile.

winforms-spreadsheet-apply-conditional-formatting-to-a-range-of-cells/VB/SpreadsheetControl/SpreadsheetActions/ConditionalFormatting.vb#L251

vb
' Set the minimum threshold to the lowest value in the range of cells using the MIN() formula.
    Dim minPoint As ConditionalFormattingValue = conditionalFormattings.CreateValue(ConditionalFormattingValueType.Formula, "=MIN($C$2:$D$15)")
' Set the midpoint threshold to the 50th percentile.

wpf-spreadsheet-how-to-apply-conditional-formatting-to-a-range-of-cells/VB/ConditionalFormatting_WPF_Examples/SpreadsheetActions/ConditionalFormatting.vb#L248

vb
' Set the minimum threshold to the lowest value in the range of cells using the MIN() formula.
Dim minPoint As ConditionalFormattingValue = conditionalFormattings.CreateValue(ConditionalFormattingValueType.Formula, "=MIN($C$2:$D$15)")
' Set the midpoint threshold to the 50th percentile.

See Also

How to: Format Cells Using a Three-Color Scale

ConditionalFormattingCollection Interface

ConditionalFormattingCollection Members

DevExpress.Spreadsheet Namespace