Syncfusion.XlsIO.Base
Example 


Color Property (IBorder)

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

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also