NativeExcel2 for .Net Developer's Reference

ICharacters.Font Property

Returns an IFont interface that represents the font of the specified Characters object.

[Visual Basic]
PropertyReadOnlyFontAsIFont
[C#]
IFontFont{get;}
[C++]
__propertyIFont*get_Font();
[JScript]
functiongetFont():IFont

Property Value

IFont interface.

Example

This example sets the font and font size for the second character in each cell within A1:F2 range to 12-point bold Arial.

[C#]
IFont font = book.Worksheets[1].Range["A1:F2"].Characters[2,1].Font;
font.Name = "Arial";
font.Size = 12;
font.Bold = true;
[VisualBasic]
Dim font As IFont = book.Worksheets(1).Range("A1:F2").Characthers(2,1).Font
font.Name = "Arial"
font.Size = 12
font.Bold = True
[C++]
IRange* range = book->Worksheets->Item[1]->Range->Item[S"A1:F2"];
IFont* font = range->Characters->Item[2,1]->Font;
font->Name = S"Arial";
font->Size = 12;
font->Bold = true;
The following example gets the font name of the second character in B2 cell.
[C#]
string name = book.Worksheets[1].Range["B2"].Characters[2,1].Font.Name;
[VisualBasic]
Dim name As String = book.Worksheets(1).Range("B2").Characthers(2,1).Font.Name
[C++]
IRange* cell = book->Worksheets->Item[1]->Range->Item[S"B2"];
String* name = cell->Characters->Item[2,1]->Font->Name;

See Also

ICharacters Interface | NativeExcel Namespace | IRange.Characters Property