NativeExcel for .Net Developer's Reference

IBorder.Weight Property

Returns or sets the weight of the border. Read/write XlBorderWeight.

[Visual Basic]
PropertyWeightAsXlBorderWeight
[C#]
XlBorderWeightWeight{get;set;}
[C++]
__propertyXlBorderWeightget_Weight();
__propertyvoidset_Weight(XlBorderWeight);
[JScript]
functiongetWeight():XlBorderWeight
functionsetWeight(XlBorderWeight);

Example

This example sets the weight of border around the A1:C5 range.

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

See Also

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