Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IRange Interface > BorderAround Method : BorderAround(ExcelLineStyle,ExcelKnownColors) Method
Represents border line style.
Represents border color.

BorderAround(ExcelLineStyle,ExcelKnownColors) Method

Applies border around the Range with the specified ExcelLineStyle and ExcelKnownColors.
Syntax
'Declaration
 
Overloads Sub BorderAround( _
   ByVal borderLine As ExcelLineStyle, _
   ByVal borderColor As ExcelKnownColors _
) 
'Usage
 
Dim instance As IRange
Dim borderLine As ExcelLineStyle
Dim borderColor As ExcelKnownColors
 
instance.BorderAround(borderLine, borderColor)

Parameters

borderLine
Represents border line style.
borderColor
Represents border color.
Example
The following code illustrates how to apply border around the Range with ExcelKnownColors.
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";
            worksheet["D2"].Text = "text";
            worksheet["C3"].Text = "in";
            worksheet["D3"].Text = "cell";
            
            //Set border
            worksheet["C2:D3"].BorderAround(ExcelLineStyle.Thick, ExcelKnownColors.Red);
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also