Syncfusion.XlsIO.Base
Example 


SecondFormula Property (IDataValidation)

Gets or sets the value or expression associated with the second part of the data validation. Second formula used only when CompareOperator have a value "Between"/"NotBetween";
Syntax
'Declaration
 
Property SecondFormula As String
'Usage
 
Dim instance As IDataValidation
Dim value As String
 
instance.SecondFormula = value
 
value = instance.SecondFormula
string SecondFormula {get; set;}
Remarks
This can be a constant value, a string value, a cell reference, or a formula. To know more about SecondFormula property refer this link.
Example
The following code illustrates the use of SecondFormula property.
using Syncfusion.XlsIO;
using System.Drawing;
             
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];
           worksheet.Range["C2"].CellStyle.Color = Color.LightGray;
           worksheet.Range["E2"].CellStyle.Color = Color.LightGray;
           worksheet.Range["C1"].Text = "Time Vaidation";
           worksheet.Range["E1"].Text = "Number Vaidation";
           worksheet.Range["C1"].AutofitColumns();
           worksheet.Range["E1"].AutofitColumns();
            
           // Date Validation for Time 
           IDataValidation dataValidation2 = worksheet.Range["C2"].DataValidation;
           dataValidation2.AllowType = ExcelDataType.Time; 
           dataValidation2.CompareOperator = ExcelDataValidationComparisonOperator.Between;
           dataValidation2.FirstFormula = "10:00"; 
           dataValidation2.SecondFormula = "12:00"; //DataValidation Value for Second Formula
            
           //Data validation for number
           IDataValidation dataValidation3 = worksheet.Range["E2"].DataValidation;
           dataValidation3.AllowType = ExcelDataType.Integer; 
           dataValidation3.CompareOperator = ExcelDataValidationComparisonOperator.NotBetween;
           dataValidation3.FirstFormula = "0"; 
           dataValidation3.SecondFormula = "10"; //DataValidation Value for Second Formula
            
           workbook.SaveAs("DataValidation.xlsx");
           workbook.Close();
           excelEngine.Dispose();
        }
     }
 }
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also