Message-ID: <800899558.7591.1711613873140.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_7590_591637424.1711613873140" ------=_Part_7590_591637424.1711613873140 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Font

Font

Description

=20

The Font class is used to specify form= atting that should be applied to a character run. It also represents the fo= nts of named styles in the document.

=20
C#
=20
 public sealed class Font
=20
=20
vb.net
=20
Public NotInheritable Class Font
=20
=20

Remarks

=20

There are two ways to obtain an instance of this class. The Document.CreateFon= t() method creates a new Font object based on the Normal s= tyle. Alternately, using NamedStyle.Font, you can create a Font object that= is a copy of a particular style's font. The Font object that = is returned can then be used in conjunction with methods in the Element class to create characte= r runs, paragraphs, etc, with specific fonts.

=20

The following example demonstrates both ways of getting a font, first by= retrieving the Normal style's font from the document, second by retrieving= a copy of the Heading1 style's font.

=20

Examples

=20
C#
=20

          //--- Get Normal font from Document
          WordApplication app =3D new WordApplication();
          Document doc =3D app.Create();
          Font normalFont =3D doc.CreateFont();

          //--- Get font from Heading1 Style
          WordApplication app =3D new WordApplication();
          Document doc =3D app.Create();
          Font heading1Font =3D doc.Styles[NamedStyle.BuiltIn.Heading1].Fon=
t;
        
=20
=20
vb.net
=20

          '--- Get Normal font from Document
          Dim app As New WordApplication()
          Dim doc As Document =3D app.Create()
          Dim normalFont As Font =3D doc.CreateFont()

          '--- Get font from Heading1 Style
          Dim app As New WordApplication()
          Dim doc As Document =3D app.Create()
          Dim heading1Font As Font =3D doc.Styles(NamedStyle.BuiltIn.Headin=
g1).Font
        
=20
=20

Properties

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

Name

Description

Anima= tion

Sets or returns a Font.TextAnimation object that represents the text animat= ion for a character run.

Bold

Sets or returns a boolean that repr= esents if a character run is bolded.

Border

Returns a B= order object on which you can manipulate the border properties of a cha= racter run.

Caps

Sets or returns a boolean that repr= esents if a character run has the All caps effect, formatting lowercase tex= t as capital letters and reducing their size. All caps formatting does not = affect numbers, punctutation, non-alphabetic chacters, or uppercase letters= .

CharacterScaling

Sets or returns an int that represe= nts the character scaling, stretching or compressing text horizontally as a= percentage of its current size. CharacterScaling can be set to a value bet= ween 1 and 600 percent. Values beyond these will be automatically adjusted.=

CharacterSpacing

Sets or returns an int that represe= nts the spacing between characters in a character run in twips. One twip = =3D (1/20 pt) or ( 1/1440 in). This number can be negative (decreased spaci= ng) or positive (increased spacing).

Do= ubleStrike

Sets or returns a boolean that repr= esents if a character run has the Double strikethrough effect, displaying a= double line through the text.

Emboss= ed

Sets or returns a boolean that repr= esents if a character run has the Emboss effect, displaying the text as if = it is raised off the page in relief.

Engrav= ed

Sets or returns a boolean that repr= esents if a character run has the Engrave effect, making the text to be imp= rinted or pressed into the page.

FontNa= me

Sets or returns a String that repre= sents the name of the font used in this formatting.

FontSi= ze

Sets or returns an float that repre= sents the font size for a character run. The font size will always be a mul= tiple of 0.5.

Hidden

Sets or returns a boolean that repr= esents if a character run has the Hidden effect set. If set to true, this f= ont will only be displayed when the display hidden flag is turned on for th= e containing document.

Highl= ight

Sets or returns the highlight color for a charac= ter run as a Color object= .

HyphenationRule

Sets or returns a Font.Hyphenation object that represents the hyphenation rul= e for a character run.

Italic

Sets or returns a boolean that repr= esents if a character run is italicized.

Kerning=

Sets or returns a double that repre= sents the kerning threshold for a character run in points.

NoProofChecking

Sets or returns a boolean that repr= esents if Word will not perform grammar and spell checking on a character r= un when the document is opened.

Outlin= ed

Sets or returns a boolean that repr= esents if a character run has the the Outline effect, displaying the inner = and outer borders of each character. (This effect is not available for all = fonts.)

Shading=

Returns a = Shading object which on which you can manipulate the shading (fill colo= r and/or pattern) properties of a character run.

Shadow

Sets or returns a boolean that repr= esents if a character run has the Shadow effect, displaying a shadow behind= , beneath and to the right of each character.

Small= Caps

Sets or returns a boolean that repr= esents if a character run has the Small caps effect, formatting lowercase t= ext as capital letters and reducing their size. Small caps formatting does = not affect numbers, punctutation, non-alphabetic chacters, or uppercase let= ters.

= SuperSubScript

Sets or returns a ScriptType object that represents whether the text in this f= ormatting is set to superscript, subscript, or none.

Strike

Sets or returns a boolean that repr= esents if a character run has the Strikethrough effect, displaying a single= line through the text.

TextC= olor

Sets or returns the color of the text in a chara= cter run as a Color objec= t.

Under= line

Sets or returns a Font.UnderlineType= object that represents the underline type for this formatting.

= UnderlineColor

Sets or returns the underline color for a charac= ter run as a Color object= .

VerticalPosition

Sets or returns a double that repre= sents the vertical position for a character run in half points, lowering or= raising the text in relation to the baseline. (For example, 2 points would= be 4 half points.)
=20

Nested Classes

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

Name

Description

Hyp= henation

Types of hyphenation rules that can be applied t= o a character run.

Scri= ptType

Values used to represent whether a character run= is formatting as superscript, subscript, or neither.

T= extAnimation

Types of text animation that can be set on a cha= racter run.

UnderlineT= ype

Types of underlines that can be applied to a cha= racter run.
------=_Part_7590_591637424.1711613873140--