Enum OperatorType

OperatorType enumeration

Represents the operator type of conditional format and data validation.

public enum OperatorType

Values

NameValueDescription
Between0Represents Between operator of conditional format and data validation.
Equal1Represents Equal operator of conditional format and data validation.
GreaterThan2Represents GreaterThan operator of conditional format and data validation.
GreaterOrEqual3Represents GreaterOrEqual operator of conditional format and data validation.
LessThan4Represents LessThan operator of conditional format and data validation.
LessOrEqual5Represents LessOrEqual operator of conditional format and data validation.
None6Represents no comparison.
NotBetween7Represents NotBetween operator of conditional format and data validation.
NotEqual8Represents NotEqual operator of conditional format and data validation.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;

    public class OperatorTypeDemo
    {
        public static void OperatorTypeExample()
        {
            // Create a new Workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Add an empty conditional formatting
            int index = worksheet.ConditionalFormattings.Add();
            FormatConditionCollection fcs = worksheet.ConditionalFormattings[index];

            // Set the conditional format range
            CellArea ca = new CellArea { StartRow = 0, EndRow = 10, StartColumn = 0, EndColumn = 10 };
            fcs.AddArea(ca);

            // Add a condition with OperatorType.Between
            int conditionIndex = fcs.AddCondition(FormatConditionType.CellValue, OperatorType.Between, "=A1", "100");
            FormatCondition fc = fcs[conditionIndex];
            fc.Style.BackgroundColor = System.Drawing.Color.Yellow;

            // Add another condition with OperatorType.GreaterThan
            int conditionIndex2 = fcs.AddCondition(FormatConditionType.CellValue, OperatorType.GreaterThan, "50", null);
            FormatCondition fc2 = fcs[conditionIndex2];
            fc2.Style.BackgroundColor = System.Drawing.Color.Green;

            // Save the workbook
            workbook.Save("OperatorTypeExample.xlsx");

            return;
        }
    }
}

See Also