Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IDataValidation Interface : IsEmptyCellAllowed Property

IsEmptyCellAllowed Property

True if empty values are permitted by the range data validation. otherwise False.
Syntax
'Declaration
 
Property IsEmptyCellAllowed As Boolean
'Usage
 
Dim instance As IDataValidation
Dim value As Boolean
 
instance.IsEmptyCellAllowed = value
 
value = instance.IsEmptyCellAllowed
bool IsEmptyCellAllowed {get; set;}
Remarks
To know more about IsEmptyCellAllowed property refer this link.
Example
The following code illustrates the use of IsEmptyCellAllowed 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["A2"].CellStyle.Color = Color.LightGray;
           worksheet.Range["A1"].Text = "Select the Day in A2";
           worksheet.Range["A1"].AutofitColumns();
           worksheet.Range["D1"].Text = "Days in a Week";
           worksheet.Range["D2"].Text = "Monday";
           worksheet.Range["D3"].Text = "Tuesday";
           worksheet.Range["D4"].Text = "Wednesday";
           worksheet.Range["D5"].Text = "Thursday";
           worksheet.Range["D6"].Text = "Friday";
           worksheet.Range["D7"].Text = "Saturday";
           worksheet.Range["D8"].Text = "Sunday";
           worksheet.Range["D1"].AutofitColumns();
           
           // DataValidation in Worksheet Range
           IDataValidation validation = worksheet.Range["A2"].DataValidation;
           validation.DataRange = worksheet.Range["D2:D8"];
           validation.IsEmptyCellAllowed = true; // Set true to allow Empty cells.
           validation.IsSuppressDropDownArrow = false;
            
           workbook.SaveAs("DataValidation.xlsx");
           workbook.Close();
           excelEngine.Dispose();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also