NativeExcel for .Net Developer's Reference

ILineFormat.ForeColor Property

Gets or sets an IColorFormat interface that represents the foreground color for the line.

[Visual Basic]
Property ForeColor As IColorFormat
[C#]
IColorFormat ForeColor { get; set; }
[C++]
__property IColorFormat* get_ForeColor();
__property void set_ForeColor(IColorFormat* );
[JScript]
function get ForeColor() : IColorFormat
function set ForeColor(IColorFormat);

Property Value

IColorFormat interface.

Example

This example changes the color of the comment border on cell B2 to red

[C#]
IComment comment = book.Worksheets[1].Range["B2"].Comment;
if (comment != null) {
   comment.Shape.Line.ForeColor.RGB = Color.FromArgb(0x0000FF);
}
[Visual Basic]
Dim comment As IComment = book.Worksheets(1).Range("B2").Comment
If Not comment Is Nothing Then
   comment.Shape.Line.ForeColor.RGB = Color.FromArgb(&H0000FF)
End If
[C++]
IComment* comment = book->Worksheets->Item[1]->Range->Item[S"B2"]->Comment;
if (comment != null) {
   comment->Shape->Line->ForeColor->RGB = Color::FromArgb(0x0000FF);
}

See Also

ILineFormat Interface | NativeExcel Namespace | IColorFormat interface | BackColor property