Syncfusion.XlsIO.Base
Example 


SecondFormulaR1C1 Property

Gets the value or expression associated with the second part of a conditional format in R1C1 notation.
Syntax
'Declaration
 
Property SecondFormulaR1C1 As String
'Usage
 
Dim instance As IConditionalFormat
Dim value As String
 
instance.SecondFormulaR1C1 = value
 
value = instance.SecondFormulaR1C1
string SecondFormulaR1C1 {get; set;}
Remarks
To know more about SecondFormulaR1C1 refer Using FormulaR1C1 property in Conditional Formats.
Example
To apply formatting by comparing the relative cell addresses we can use SecondFormulaR1C1. Here for example, we compare the adjacent cell values and apply formatting. SecondFormulaR1C1 can also used along with FirstFormulaR1C1 to add additional condition.
using Syncfusion.XlsIO;
            
class Example
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create a worksheet.        
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Load data to Apply Conditional Formatting.
            worksheet["B1"].Text = "Conditional Formats";
            worksheet["B2"].Number = 1;
            worksheet["B3"].Number = 2;
            worksheet["B4"].Number = 3;
            worksheet["B5"].Number = 4;
            worksheet["B6"].Number = 5;
            worksheet["B7"].Number = 6;
            worksheet["B8"].Number = 7;
            worksheet["B9"].Number = 8;
            worksheet["B10"].Number = 9;
            worksheet["B11"].Number = 10;
            
            //Data to be compared.
            worksheet["C2"].Number = 11;
            worksheet["C3"].Number = 1;
            worksheet["C4"].Number = 3;
            worksheet["C5"].Number = 2;
            worksheet["C6"].Number = 5;
            worksheet["C7"].Number = 3;
            worksheet["C8"].Number = 7;
            worksheet["C9"].Number = 9;
            worksheet["C10"].Number = 19;
            worksheet["C11"].Number = 20;
            
            
            //Create instance of IConditionalFormats.
            IConditionalFormats formats = worksheet["B2:B11"].ConditionalFormats;
            
            //Add condition.
            IConditionalFormat format = formats.AddCondition();
            
            //Set FormatType.
            format.FormatType = ExcelCFType.Formula;
            
            //Set Formula.
            format.SecondFormulaR1C1 = "=RC>RC[1]";
            
            //Set color.
            format.BackColor = ExcelKnownColors.Red;
            
            //Save and Dispose.
            workbook.SaveAs("ConditionalFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also