Syncfusion.XlsIO.Base
Example 


Color Property (IFont)

Returns or sets the primary color of the object. Read / write ExcelKnownColors.
Syntax
'Declaration
 
Property Color As ExcelKnownColors
'Usage
 
Dim instance As IFont
Dim value As ExcelKnownColors
 
instance.Color = value
 
value = instance.Color
ExcelKnownColors Color {get; set;}
Example
The following code illustrates how a color from ExcelKnownColors enumeration can be set to font.
using Syncfusion.XlsIO;
            
class Program
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Set text
            worksheet["C2"].Text = "Sample";
            
            //Add style
            IStyle style = workbook.Styles.Add("CustomStyle");
            
            //Set style
            worksheet["C2"].CellStyle = style;
            
            //Set font
            IFont font = style.Font;
            
            //Set color
            font.Color = ExcelKnownColors.Red;
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also