Font Class |
Namespace: Aspose.Words
The Font type exposes the following members.
| Name | Description | |
|---|---|---|
| AllCaps |
True if the font is formatted as all capital letters.
| |
| AutoColor |
Returns the present calculated color of the text (black or white) to be used for 'auto color'.
If the color is not 'auto' then returns Color.
| |
| Bidi |
Specifies whether the contents of this run shall have right-to-left characteristics.
| |
| Bold |
True if the font is formatted as bold.
| |
| BoldBi |
True if the right-to-left text is formatted as bold.
| |
| Border |
Returns a Border object that specifies border for the font.
| |
| Color |
Gets or sets the color of the font.
| |
| ComplexScript |
Specifies whether the contents of this run shall be treated as complex script text regardless
of their Unicode character values when determining the formatting for this run.
| |
| DoubleStrikeThrough |
True if the font is formatted as double strikethrough text.
| |
| Emboss |
True if the font is formatted as embossed.
| |
| Engrave |
True if the font is formatted as engraved.
| |
| Hidden |
True if the font is formatted as hidden text.
| |
| HighlightColor |
Gets or sets the highlight (marker) color.
| |
| Italic |
True if the font is formatted as italic.
| |
| ItalicBi |
True if the right-to-left text is formatted as italic.
| |
| Kerning |
Gets or sets the font size at which kerning starts.
| |
| LineSpacing |
Returns line spacing of this font (in points).
| |
| LocaleId |
Gets or sets the locale identifier (language) of the formatted characters.
| |
| LocaleIdBi |
Gets or sets the locale identifier (language) of the formatted right-to-left characters.
| |
| LocaleIdFarEast |
Gets or sets the locale identifier (language) of the formatted Asian characters.
| |
| Name |
Gets or sets the name of the font.
| |
| NameAscii |
Returns or sets the font used for Latin text (characters with character codes from 0 (zero) through 127).
| |
| NameBi |
Returns or sets the name of the font in a right-to-left language document.
| |
| NameFarEast |
Returns or sets an East Asian font name.
| |
| NameOther |
Returns or sets the font used for characters with character codes from 128 through 255.
| |
| NoProofing |
True when the formatted characters are not to be spell checked.
| |
| Outline |
True if the font is formatted as outline.
| |
| Position |
Gets or sets the position of text (in points) relative to the base line.
A positive number raises the text, and a negative number lowers it.
| |
| Scaling |
Gets or sets character width scaling in percent.
| |
| Shading |
Returns a Shading object that refers to the shading formatting for the font.
| |
| Shadow |
True if the font is formatted as shadowed.
| |
| Size |
Gets or sets the font size in points.
| |
| SizeBi |
Gets or sets the font size in points used in a right-to-left document.
| |
| SmallCaps |
True if the font is formatted as small capital letters.
| |
| Spacing |
Returns or sets the spacing (in points) between characters .
| |
| StrikeThrough |
True if the font is formatted as strikethrough text.
| |
| Style |
Gets or sets the character style applied to this formatting.
| |
| StyleIdentifier |
Gets or sets the locale independent style identifier of the character style applied to this formatting.
| |
| StyleName |
Gets or sets the name of the character style applied to this formatting.
| |
| Subscript |
True if the font is formatted as subscript.
| |
| Superscript |
True if the font is formatted as superscript.
| |
| TextEffect |
Gets or sets the font animation effect.
| |
| Underline |
Gets or sets the type of underline applied to the font.
| |
| UnderlineColor |
Gets or sets the color of the underline applied to the font.
|
| Name | Description | |
|---|---|---|
| ClearFormatting |
Resets to default font formatting.
| |
| Equals | (Inherited from Object.) | |
| GetHashCode | (Inherited from Object.) | |
| GetType | (Inherited from Object.) | |
| HasDmlEffect |
Checks if particular DrawingML text effect is applied.
| |
| ToString | (Inherited from Object.) |
You do not create instances of the Font class directly. You just use Font to access the font properties of the various objects such as Run, Paragraph, Style, DocumentBuilder.
DocumentBuilder builder = new DocumentBuilder(); builder.Font.Border.Color = Color.Green; builder.Font.Border.LineWidth = 2.5; builder.Font.Border.LineStyle = LineStyle.DashDotStroker; builder.Write("run of text in a green border");
// Create an empty document. It contains one empty paragraph Document doc = new Document(); // Create a new run of text Run run = new Run(doc, "Hello"); // Specify character formatting for the run of text Aspose.Words.Font f = run.Font; f.Name = "Courier New"; f.Size = 36; f.HighlightColor = Color.Yellow; // Append the run of text to the end of the first paragraph // in the body of the first section of the document doc.FirstSection.Body.FirstParagraph.AppendChild(run);
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Create a paragraph style and specify some formatting for it Style style = doc.Styles.Add(StyleType.Paragraph, "MyStyle1"); style.Font.Size = 24; style.Font.Name = "Verdana"; style.ParagraphFormat.SpaceAfter = 12; // Create a list and make sure the paragraphs that use this style will use this list style.ListFormat.List = doc.Lists.Add(ListTemplate.BulletDefault); style.ListFormat.ListLevelNumber = 0; // Apply the paragraph style to the current paragraph in the document and add some text builder.ParagraphFormat.Style = style; builder.Writeln("Hello World: MyStyle1, bulleted."); // Change to a paragraph style that has no list formatting builder.ParagraphFormat.Style = doc.Styles["Normal"]; builder.Writeln("Hello World: Normal."); builder.Document.Save(ArtifactsDir + "Lists.ParagraphStyleBulleted.doc");