Search Results for

    Show / Hide Table of Contents

    Class ConditionType

    Represents a type of a conditional formatting rule

    Inheritance
    System.Object
    ConditionType
    Namespace: IronXL.Formatting
    Assembly: IronXL.dll
    Syntax
    public class ConditionType : Object

    ConditionType names the kind of test a conditional formatting rule runs, so a developer chooses whether a rule compares a cell value, paints a color scale, draws a data bar, or evaluates a formula. It is the type-safe set of condition categories that sits behind a ConditionalFormattingRule, and it answers the "what triggers this rule" question a developer faces when styling a spreadsheet by criteria.

    A ConditionType reaches a rule through the ConditionType property on ConditionalFormattingRule. When a rule is created through CreateConditionalFormattingRule, IronXL sets the appropriate condition category for that rule; reading the property tells a developer which test the rule performs. The value belongs to the rule that conditional formatting on a worksheet applies to a cell range.

    The members cover the conditional formatting categories Excel supports. CellValueIs compares the cell against a constant with a comparison operator, the everyday case for "less than 8" or "greater than 100". Formula evaluates a custom expression. ColorScale, DataBar, and IconSet drive the graphical condition types that shade cells, draw in-cell bars, or place status icons. Filter covers top/bottom and similar filter conditions. Each value exposes a numeric Id and a Type, and the static ForId method resolves a ConditionType from its byte or integer id when a rule is read back from a loaded file. Most code does not name ConditionType directly, because CreateConditionalFormattingRule selects it, so reach for it when inspecting or branching on a rule's category.

    using IronXL;
    using IronXL.Formatting;
    
    WorkBook book = WorkBook.Load("report.xlsx");
    WorkSheet sheet = book.DefaultWorkSheet;
    ConditionalFormattingRule rule =
        sheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.LessThan, "8");
    Console.WriteLine(rule.ConditionType.Type);

    The conditional formatting how-to walks through building rules, the conditional formatting example shows a working rule applied to a range, and the style cells example covers the styles a rule can apply.

    Fields

    CellValueIs

    This conditional formatting rule compares a cell value to a formula calculated result, using an operator

    Declaration
    public static ConditionType CellValueIs
    Field Value
    Type Description
    ConditionType

    ColorScale

    Declaration
    public static ConditionType ColorScale
    Field Value
    Type Description
    ConditionType

    DataBar

    This conditional formatting rule sets a data bar, with the cell populated with bars based on their values

    Declaration
    public static ConditionType DataBar
    Field Value
    Type Description
    ConditionType

    Filter

    This conditional formatting rule that files the values

    Declaration
    public static ConditionType Filter
    Field Value
    Type Description
    ConditionType

    Formula

    This conditional formatting rule contains a formula to evaluate. When the formula result is true, the cell is highlighted.

    Declaration
    public static ConditionType Formula
    Field Value
    Type Description
    ConditionType

    IconSet

    This conditional formatting rule sets a data bar, with the cell populated with bars based on their values

    Declaration
    public static ConditionType IconSet
    Field Value
    Type Description
    ConditionType

    Properties

    Id

    Type's numeric id

    Declaration
    public byte Id { get; set; }
    Property Value
    Type Description
    System.Byte

    Type

    Internal condition type name

    Declaration
    public string Type { get; set; }
    Property Value
    Type Description
    System.String

    Methods

    Equals(Object)

    Determines whether the specified object is equal to the current ConditionType.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    The object to compare with the current ConditionType.

    Returns
    Type Description
    System.Boolean

    true if the specified object is equal to the current object; otherwise, false.

    ForId(Byte)

    Get ConditionType for specified id

    Declaration
    public static ConditionType ForId(byte id)
    Parameters
    Type Name Description
    System.Byte id

    ConditionType id

    Returns
    Type Description
    ConditionType

    ConditionType that corresponds to specified id

    ForId(Int32)

    Get ConditionType for specified id

    Declaration
    public static ConditionType ForId(int id)
    Parameters
    Type Name Description
    System.Int32 id

    ConditionType id

    Returns
    Type Description
    ConditionType

    ConditionType that corresponds to specified id

    GetHashCode()

    Hash function

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    Hash code for current ConditionType

    ToString()

    Represents ConditionType in a string format

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    Operators

    Explicit(ConditionType to <b7b8378d-f600-4305-960a-074ac349f14c>ConditionType)

    Declaration
    public static explicit operator  < b7b8378d - f600 - 4305 - 960  a - 074  ac349f14c > ConditionType(ConditionType obj)
    Parameters
    Type Name Description
    ConditionType obj
    Returns
    Type Description
    NPOI.SS.UserModel.<b7b8378d-f600-4305-960a-074ac349f14c>ConditionType

    Explicit(<b7b8378d-f600-4305-960a-074ac349f14c>ConditionType to ConditionType)

    Declaration
    public static explicit operator ConditionType( < b7b8378d - f600 - 4305 - 960  a - 074  ac349f14c > ConditionType obj)
    Parameters
    Type Name Description
    NPOI.SS.UserModel.<b7b8378d-f600-4305-960a-074ac349f14c>ConditionType obj
    Returns
    Type Description
    ConditionType
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    IronXL_for_dotnet_log2o
    Blue key in circleGet started for FREE
    No credit card required
    Test in a live environment

    Test in production without watermarks.
    Works wherever you need it to.

    Fully-functional product

    Get 30 days of fully functional product.
    Have it up and running in minutes.

    24/5 technical support

    Full access to our support engineering team during your product trial

    Grey key in circleGet started for FREE
    The trial form was submitted successfully.
    Calendar in circleBook Free Live Demo
    No contact, no card details, no commitments Book a 30-minute, personal demo.
    Here's what to expect:

    A live demo of our product and its key features

    Get project specific feature recommendations

    All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation
    Support Team Member 6 related to The C# PDF Library Support Team Member 14 related to The C# PDF Library Support Team Member 4 related to The C# PDF Library Support Team Member 2 related to The C# PDF Library
    Online 24/5
    Need help? Our sales team would be glad to help you.
    Try the Enterprise Trial
    ironpdf_for_dotnet_log2o
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    bullet_checkedNo credit card or account creation required
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    Blue key in circleNo credit card or account creation required
    Green Check in orange circle
    The trial form was submitted successfully.
    badge_greencheck_in_yellowcircle
    Thank you for starting a trial

    Please check your email for the trial license key.

    If you don’t receive an email, please start a live chat or email support@ironsoftware.com

    Install with NuGet
    View Licensing
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronXL