Syncfusion.XlsIO.Base
Example 


Type Property (IColorConditionValue)

Gets or sets the ConditionValueType for the color scale conditional format.
Syntax
'Declaration
 
Property Type As ConditionValueType
'Usage
 
Dim instance As IColorConditionValue
Dim value As ConditionValueType
 
instance.Type = value
 
value = instance.Type
ConditionValueType Type {get; set;}
Example
The Type property is used to change the ConditionValueType of the IColorConditionValue object. Default values will be ConditionValueType.LowestValue and ConditionValueType.HighestValue if the IColorScale.SetConditionCount is not set. If the count is set to 3, then the values will be ConditionValueType.LowestValue, ConditionValueType.Percentile and ConditionValueType.HighestValue. In our example we are change the default value of first object in list to ConditionValueType.Percentile and set Value to 60.
using Syncfusion.XlsIO;
            
class Example
{
    static void Main()
    {
        //Create a worksheet.        
        ExcelEngine excelEngine = new ExcelEngine();
        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["A1"].Text = "ColorScale";
        worksheet["A2"].Number  =  10;
        worksheet["A3"].Number  =  20;
        worksheet["A4"].Number  =  30;
        worksheet["A5"].Number  =  40;
        worksheet["A6"].Number  =  50;
        worksheet["A7"].Number  =  60;
        worksheet["A8"].Number  =  70;
        worksheet["A9"].Number  =  80;
        worksheet["A10"].Number =  90;
        worksheet["A11"].Number =  100;
        
        //Create instance of IConditonalFormat and IConditionalFormats.
        IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
        IConditionalFormat format = formats.AddCondition();
            
        //Set FormatType as ColorScale.
        format.FormatType = ExcelCFType.ColorScale;
        IColorScale colorScale = format.ColorScale;
        
        //Set Type and Value
        colorScale.Criteria[0].Type = ConditionValueType.Percent;
        colorScale.Criteria[0].Value = "60";
            
        //Save and Dispose.
        workbook.SaveAs("ConditionalFormats.xlsx");
        workbook.Close();
        excelEngine.Dispose();
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also