Search Results for

    Show / Hide Table of Contents

    Interface IBorderFormatting

    Interface that represents border formatting options of conditional formatting.

    Namespace: IronXL.Formatting
    Assembly: IronXL.dll
    Syntax
    public interface IBorderFormatting

    When a conditional formatting rule needs to draw borders around the cells it matches, IBorderFormatting is the contract that defines those borders. A rule that highlights overdue rows or out-of-range values uses it to outline the affected cells, so the emphasis is a visible box and not only a fill or font change. It is the border side of conditional formatting, distinct from the static IBorder that styles a cell directly.

    A developer obtains IBorderFormatting from ConditionalFormattingRule.BorderFormatting, the get-only property on a rule created through a worksheet's conditional formatting surface. The borders set here apply only when the rule's condition is met, which is what separates conditional borders from the always-on borders of IStyle. Configure the property's members on the rule before the rule is added to the sheet.

    The members are organized by cell edge, each edge carrying a color and a line type. The four sides expose TopBorderColor, BottomBorderColor, LeftBorderColor, and RightBorderColor as RGB strings, paired with TopBorderType, BottomBorderType, LeftBorderType, and RightBorderType as BorderType values for the line weight and style. The diagonal pair, DiagonalBorderColor and DiagonalBorderType, draws a line across the cell for the cases that call for it. Set only the edges a rule needs; an untouched side stays as the cell already renders it, so a rule that only wants a bottom rule leaves the other three sides alone. Pairing a color with a visible BorderType is what makes the edge render, since a color on its own does not produce a line.

    using IronXL;
    using IronXL.Formatting;
    using IronXL.Styles;
    
    WorkSheet sheet = WorkBook.Load("report.xlsx").DefaultWorkSheet;
    ConditionalFormattingRule rule = sheet.ConditionalFormatting
        .CreateConditionalFormattingRule(ComparisonOperator.LessThan, "0");
    rule.BorderFormatting.BottomBorderColor = "#C00000";
    rule.BorderFormatting.BottomBorderType = BorderType.Thick;

    The conditional formatting how-to walks through building rules, the conditional formatting example shows a worked rule, and the border and alignment how-to covers static cell borders for comparison.

    Properties

    BottomBorderColor

    Gets or sets the color of the bottom border.

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

    The color of the bottom border.

    BottomBorderType

    Gets or sets the border bottom line style.

    Declaration
    BorderType BottomBorderType { get; set; }
    Property Value
    Type Description
    BorderType

    The border bottom line style.

    DiagonalBorderColor

    Gets or sets the color of the diagonal border.

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

    The color of the diagonal border.

    DiagonalBorderType

    Gets or sets the border diagonal line style.

    Declaration
    BorderType DiagonalBorderType { get; set; }
    Property Value
    Type Description
    BorderType

    The border diagonal line style.

    LeftBorderColor

    Gets or sets the color of the left border.

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

    The color of the left border.

    LeftBorderType

    Gets or sets the border left line style.

    Declaration
    BorderType LeftBorderType { get; set; }
    Property Value
    Type Description
    BorderType

    The border left line style.

    RightBorderColor

    Gets or sets the color of the right border.

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

    The color of the right border.

    RightBorderType

    Gets or sets the border right line style.

    Declaration
    BorderType RightBorderType { get; set; }
    Property Value
    Type Description
    BorderType

    The border right line style.

    TopBorderColor

    Gets or sets the color of the top border.

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

    The color of the top border.

    TopBorderType

    Gets or sets the border top line style.

    Declaration
    BorderType TopBorderType { get; set; }
    Property Value
    Type Description
    BorderType

    The border top line style.

    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget