Represents character formatting attributes (font name, font size, color, and so on) of an object.
For a list of all members of this type, see Font Members.
System.Object
Aspose.Editor.Core.Attribute.AttrGroup
Aspose.Editor.Core.Attribute.RangeAttrGroup
Aspose.Editor.Desktop.Font
[Visual Basic]NotInheritable Public Class Font
Remarks
You do not create instances of the Font class directly. You access Font as a property of objects that can have character formatting, for example Font of the Range object.
A consecutive series of characters in a document that have same character formatting is called a "run". A single Range or Selection can encompass a number of runs with different formatting, but a single Font is always returned.
For example, a single Range can include characters of two runs, first run is bold and second run is not bold. In this case, properties of the Font object return the value from the first run in the range, that is Bold will return true.
When setting any of the Font properties for a range that contains multiple runs, the new value is applied to all characters within the range. In the above case, setting Bold to true, will make all characters in the range bold.
Example
Creates a simple Hello World document.
[C#]
Document doc = new Document();
Range range = doc.GetRange();
range.Text = "Hello World!";
range.Font.Name = "Arial";
range.Font.Size = 48;
range.Font.Italic = true;
range.Font.Color = Color.Red;
range.ParagraphFormat.SpaceBefore = 24;
range.ParagraphFormat.Alignment = ParagraphAlignment.Center;
range.ParagraphFormat.SpaceAfter = 24;
doc.Save(MyPath + "ExRange.HelloWorld Out.xml");
[Visual Basic]
Dim doc As New Document()
Dim range As Range = doc.GetRange()
range.Text = "Hello World!"
range.Font.Name = "Arial"
range.Font.Size = 48
range.Font.Italic = True
range.Font.Color = Color.Red
range.ParagraphFormat.SpaceBefore = 24
range.ParagraphFormat.Alignment = ParagraphAlignment.Center
range.ParagraphFormat.SpaceAfter = 24
doc.Save(MyPath & "ExRange.HelloWorld Out.xml")
Requirements
Namespace: Aspose.Editor.Desktop
Assembly: Aspose.Editor.Desktop (in Aspose.Editor.Desktop.dll)
See Also
Font Members | Aspose.Editor.Desktop Namespace | Range | ParagraphFormat