Document Solutions for Excel, .NET Edition | Document Solutions
Features / Conditional Formatting / Top Bottom Rule
In This Topic
    Top Bottom Rule
    In This Topic

    The top bottom rule checks whether the values in the top or bottom of a cell range match with the required values in the cell. In case the values don't match, the data is considered as invalid. This rule can be added using the properties and methods of the ITop10 interface.

    The following options are available while adding top bottom rule in a worksheet:

    Refer to the following example code to add top bottom rule in a worksheet.

    C#
    Copy Code
    // Adding ToBottom rule
    worksheet.Range["A1:A5"].Value = new object[,]
    {
        {1},
        {2},
        {3},
        {4},
        {5}
    };
    
    ITop10 condition = worksheet.Range["A1:A5"].FormatConditions.AddTop10();
    condition.TopBottom = TopBottom.Top10Top;
    condition.Rank = 50;
    condition.Percent = true;
    condition.Interior.Color = Color.FromArgb(128, 0, 128);