Syncfusion.XlsIO.Base
Example 


LineStyle Property (IBorder)

Returns or sets the line style for the border. Read/write ExcelLineStyle.
Syntax
'Declaration
 
Property LineStyle As ExcelLineStyle
'Usage
 
Dim instance As IBorder
Dim value As ExcelLineStyle
 
instance.LineStyle = value
 
value = instance.LineStyle
ExcelLineStyle LineStyle {get; set;}
Remarks
To know more about borders refer Apply Border Settings.
Example
By default LineStyle is set to ExcelLineStyle.None so borders are not applied. Here for example, we set ExcelLineStyle.Thick to ExcelBordersIndex.EdgeTop and ExcelBordersIndex.EdgeBottom borders.
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