Syncfusion.XlsIO.Base
Example 


Underline Property (IConditionalFormat)

Gets or sets the underline type for the conditional format.
Syntax
'Declaration
 
Property Underline As ExcelUnderline
'Usage
 
Dim instance As IConditionalFormat
Dim value As ExcelUnderline
 
instance.Underline = value
 
value = instance.Underline
ExcelUnderline Underline {get; set;}
Remarks
Similar to Underline, we can use IsStrikeThrough to strike out values in the cells within conditional formatting range.
Example
Data in the cells can be given underline with the help of conditional formats. To give underline Underline property should be set to any of the value in the ExcelUnderline enumeration. Here for example, we set ExcelUnderline.Double to Underline property.
using Syncfusion.XlsIO;
using System;
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];
            
            //Load data to Apply Conditional Formatting.
            worksheet["B1"].Text = "Conditional Formats";
            worksheet["B2"].Number = 10;
            worksheet["B3"].Number = 20;
            worksheet["B4"].Number = 30;
            worksheet["B5"].Number = 40;
            worksheet["B6"].Number = 50;
            worksheet["B7"].Number = 60;
            worksheet["B8"].Number = 70;
            worksheet["B9"].Number = 80;
            worksheet["B10"].Number = 90;
            worksheet["B11"].Number = 100;
            
            //Create instance of IConditonalFormat and IConditionalFormats.
            IConditionalFormats formats = worksheet["B2:B11"].ConditionalFormats;
            IConditionalFormat format = formats.AddCondition();
            
            //Set Condition.
            format.FirstFormula = "60";
            format.SecondFormula = "20";
            format.Operator = ExcelComparisonOperator.Between;
            
            //Set UnderLine.
            format.Underline = ExcelUnderline.Double;
            
            //Save and Dispose.
            workbook.SaveAs("ConditionalFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also