Syncfusion.XlsIO.Base
Example 


ColorObject Property

Returns or sets the primary color of the object.
Syntax
'Declaration
 
ReadOnly Property ColorObject As ColorObject
'Usage
 
Dim instance As IBorder
Dim value As ColorObject
 
value = instance.ColorObject
ColorObject ColorObject {get;}
Example
The following code illustrates how to access ColorObject and set a color from ExcelKnownColors to the border.
using Syncfusion.XlsIO;
using Syncfusion.XlsIO.Implementation;
            
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 borders
            IBorders borders = worksheet["C2"].Borders;
            
            //Set color object
            ColorObject colorObject = borders[ExcelBordersIndex.EdgeTop].ColorObject;
            
            //Set color
            colorObject.SetIndexed(ExcelKnownColors.Red);
            
            //Set line style
            borders.LineStyle = ExcelLineStyle.Thick;
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also