NativeExcel for .Net Developer's Reference

ILineFormat Interface

Represents line formatting. For a shape with a border, this interface contains formatting information for the shape's border.

For a list of all members of this type, see ILineFormat Members.

[Visual Basic]


Use the Line property to return an ILineFormat interface.


The following example adds a green, dashed border to first shape on sheet one.

IShapes shapes = book.Worksheets[1].Shapes;
if (shapes.Count > 0) {
   ILineFormat line = shapes[1].Line;
   line.Style     = MsoLineStyle.msoLineSingle;
   line.DashStyle = MsoLineDashStyle.msoLineDash;
   line.Weight    = 2;
   line.Visible   = true;
   line.ForeColor.RGB = System.Drawing.Color.FromArgb(0x00A000);
Dim shapes As IShapes = book.Worksheets(1).Shapes
If shapes.Count > 0 Then
   Dim line As ILineFormat = shapes(1).Line
   line.Style     = MsoLineStyle.msoLineSingle
   line.DashStyle = MsoLineDashStyle.msoLineDash
   line.Weight    = 2
   line.Visible   = True
   line.ForeColor.RGB = System.Drawing.Color.FromArgb(&H00A000)
End If
IShapes* shapes = book->Worksheets->Item[1]->Shapes;
if (shapes->Count > 0) {
   ILineFormat* line = shapes->Item[1]->Line;
   line->Style     = MsoLineStyle::msoLineSingle;
   line->DashStyle = MsoLineDashStyle::msoLineDash;
   line->Weight    = 2;
   line->Visible   = true;
   line->ForeColor.RGB = System::Drawing::Color::FromArgb(0x00A000);


Namespace: NativeExcel

Assembly: NativeExcel (in NativeExcel.dll)

See Also

ILineFormat Members | NativeExcel Namespace | IShape.Line Property | IShape interface