NativeExcel2 for .Net Developer's Reference

IBorder.LineStyle Property

Returns or sets the line style for the border. Read/write XlLineStyle.

[Visual Basic]
PropertyLineStyleAsXlLineStyle
[C#]
XlLineStyleLineStyle{get;set;}
[C++]
__propertyXlLineStyleget_LineStyle();
__propertyvoidset_LineStyle(XlLineStyle);
[JScript]
functiongetLineStyle():XlLineStyle
functionsetLineStyle(XlLineStyle);

Example

This example puts a border around the A1:C5 range.

[C#]
IBorders borders = book.Worksheets[1].Range["A1:C5"].Borders;
borders[XlBordersIndex.xlEdgeTop].LineStyle    = XlLineStyle.xlDot;
borders[XlBordersIndex.xlEdgeBottom].LineStyle = XlLineStyle.xlDot;
borders[XlBordersIndex.xlEdgeLeft].LineStyle   = XlLineStyle.xlDot;
borders[XlBordersIndex.xlEdgeRight].LineStyle  = XlLineStyle.xlDot;
[VisualBasic]
Dim borders As IBorders = book.Worksheets(1).Range("A1:C5").Borders
borders(XlBordersIndex.xlEdgeTop).LineStyle    = XlLineStyle.xlDot
borders(XlBordersIndex.xlEdgeBottom).LineStyle = XlLineStyle.xlDot
borders(XlBordersIndex.xlEdgeLeft).LineStyle   = XlLineStyle.xlDot
borders(XlBordersIndex.xlEdgeRight).LineStyle  = XlLineStyle.xlDot
[C++]
IBorders* borders = book->Worksheets->Item[1]->Range->Item[S"A1:C5"]->Borders;
borders->Item[XlBordersIndex::xlEdgeTop]->LineStyle    = XlLineStyle::xlDot;
borders->Item[XlBordersIndex::xlEdgeBottom]->LineStyle = XlLineStyle::xlDot;
borders->Item[XlBordersIndex::xlEdgeLeft]->LineStyle   = XlLineStyle::xlDot;
borders->Item[XlBordersIndex::xlEdgeRight]->LineStyle  = XlLineStyle::xlDot;
This example is the same as the previous.
[C#]
book.Worksheets[1].Range["A1:C5"].Borders[XlBordersIndex.xlAround].LineStyle = XlLineStyle.xlDot; 
[VisualBasic]
book.Worksheets(1).Range("A1:C5").Borders(XlBordersIndex.xlAround).LineStyle = XlLineStyle.xlDot 
[C++]
IBorders* borders = book->Worksheets->Item[1]->Range->Item[S"A1:C5"]->Borders;
borders->Item[XlBordersIndex::xlAround]->LineStyle = XlLineStyle::xlDot; 

See Also

IBorder Interface | NativeExcel Namespace | XlLineStyle Enumeration | IRange.Borders Property | IBorders Interface