NativeExcel for .Net Developer's Reference

IFillFormat.ForeColor Property

Gets or sets an IColorFormat interface that represents the specified fill foreground color.

[Visual Basic]
PropertyForeColorAsIColorFormat
[C#]
IColorFormatForeColor{get;set;}
[C++]
__propertyIColorFormat*get_ForeColor();
__propertyvoidset_ForeColor(IColorFormat*);
[JScript]
functiongetForeColor():IColorFormat
functionsetForeColor(IColorFormat);

Property Value

IColorFormat interface.

Example

This example creates a comment on cell B2 with pink background

[C#]
IRange range = book.Worksheets[1].Range["B2"];
IComment comment = range.AddComment("Comment text");
comment.Shape.Fill.Visible = true;
comment.Shape.Fill.Solid();
comment.Shape.Fill.ForeColor.RGB = System.Drawing.Color.FromArgb(0xF0F0FF);
[VisualBasic]
Dim range As IRange = book.Worksheets(1).Range("B2")
Dim comment As IComment = range.AddComment("Comment text")
comment.Shape.Fill.Visible = True
comment.Shape.Fill.Solid()
comment.Shape.Fill.ForeColor.RGB = System.Drawing.Color.FromArgb(&HF0F0FF)
[C++]
IRange* range = book->Worksheets->Item[1]->Range->Item[S"B2"];
IComment* comment = range->AddComment(S"Comment text");
comment->Shape->Fill->Visible = true;
comment->Shape->Fill->Solid();
comment->Shape->Fill->ForeColor->RGB = System::Drawing::Color::FromArgb(0xF0F0FF);

See Also

IFillFormat Interface | NativeExcel Namespace | IColorFormat interface | BackColor property