Search Results for

    Show / Hide Table of Contents

    Class TextStyle

    Represents the TextStyle applied to an paragraph or text.

    Inheritance
    System.Object
    TextStyle
    Implements
    ITextStyle
    IronSoftware.Abstractions.Word.ITextStyle
    IDerivedStyle
    IronSoftware.Abstractions.Word.IDerivedStyle
    IronSoftware.Abstractions.Word.IStyle
    IronSoftware.Abstractions.Word.IWordDocumentObjectProperty
    IronSoftware.Abstractions.IDocumentObjectProperty
    Namespace: IronWord.Models
    Assembly: IronWord.dll
    Syntax
    public class TextStyle : Object, ITextStyle, IDerivedStyle

    Formatting the characters in a Word run, everything from bold and color to outlines and small caps, runs through TextStyle. It is the character-level style object you assign to a run's Style property, collecting the typeface, color, weight, and decorations that determine how a stretch of text looks when the document is saved.

    A TextStyle reaches text through TextContent, whose Style property is a TextStyle. Build a style once and assign it to as many runs as share the look, or start from the static DefaultStyle and adjust from there. The BaseStyle property links to a named document style, so a run can inherit a base and override only the properties it changes, keeping a document's formatting consistent.

    Because the surface is large, it helps to read the properties in functional groups. **Typeface and size**: TextFont, FontSize, FontSizeComplexScript, and CharacterScale. **Weight and slant**: IsBold and IsItalic. **Color and fill**: Color and a Shading. **Decorations**: Underline, Strike, Caps, SmallCaps, Emboss, Imprint, Outline, Shadow, and the richer TextEffect. **Spacing and position**: Spacing, Kern, VerticalPosition, VerticalTextAlignment, and SnapToGrid. **Visibility and proofing**: Vanish, SpecVanish, WebHidden, NoProof, Emphasis, and Languages. The Status property reports an ElementStatus, and Reset clears the style back to its defaults. Set only the properties a design needs and leave the rest inherited from the base or default.

    using IronWord.Models;
    
    var style = new TextStyle();
    style.IsBold = true;
    style.FontSize = 14;
    style.Color = Color.Black;

    The style text how-to applies character formatting, the add text how-to places the runs, and the document element tutorial shows where styles sit in the model.

    Constructors

    TextStyle()

    Initializes a new instance of the TextStyle class.

    Declaration
    public TextStyle()

    Properties

    BaseStyle

    The original base style definition a style is based off of.

    Declaration
    public IBaseStyle BaseStyle { get; set; }
    Property Value
    Type Description
    IBaseStyle

    Caps

    Declaration
    public Nullable<bool> Caps { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    CharacterScale

    Declaration
    public Nullable<int> CharacterScale { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    Color

    The color of the text.

    Declaration
    public Color Color { get; set; }
    Property Value
    Type Description
    Color

    DefaultStyle

    The default text style.

    Declaration
    public ITextStyle DefaultStyle { get; }
    Property Value
    Type Description
    ITextStyle

    Emboss

    Declaration
    public Nullable<bool> Emboss { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    Emphasis

    The emphasis mark style applied to the text.

    Declaration
    public Nullable<EmphasisMarkValues> Emphasis { get; set; }
    Property Value
    Type Description
    System.Nullable<EmphasisMarkValues>

    FontSize

    Declaration
    public Nullable<float> FontSize { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Single>

    FontSizeComplexScript

    Declaration
    public Nullable<float> FontSizeComplexScript { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Single>

    Imprint

    Declaration
    public Nullable<bool> Imprint { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    IsBold

    Declaration
    public Nullable<bool> IsBold { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    IsItalic

    Declaration
    public Nullable<bool> IsItalic { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    Kern

    Declaration
    public Nullable<int> Kern { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    Languages

    Declaration
    public string Languages { get; set; }
    Property Value
    Type Description
    System.String

    NoProof

    Declaration
    public Nullable<bool> NoProof { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    Outline

    Gets or sets a value indicating whether the text is outlined.

    Declaration
    public Nullable<bool> Outline { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    Shading

    The background shading applied to the text.

    Declaration
    public Shading Shading { get; set; }
    Property Value
    Type Description
    Shading

    Shadow

    Declaration
    public Nullable<bool> Shadow { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    SmallCaps

    Gets or sets a value indicating whether the text is in small capital letters.

    Declaration
    public Nullable<bool> SmallCaps { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    SnapToGrid

    Declaration
    public Nullable<bool> SnapToGrid { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    Spacing

    Declaration
    public Nullable<int> Spacing { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    SpecVanish

    Declaration
    public Nullable<bool> SpecVanish { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    Status

    Status of the element.

    Declaration
    public ElementStatus Status { get; set; }
    Property Value
    Type Description
    IronSoftware.Abstractions.Word.ElementStatus

    Strike

    Gets or sets a value indicating whether the text is struck through.

    Declaration
    public Nullable<StrikeValue> Strike { get; set; }
    Property Value
    Type Description
    System.Nullable<StrikeValue>

    TextEffect

    The special text effect applied to the text.

    Declaration
    public TextEffect TextEffect { get; set; }
    Property Value
    Type Description
    TextEffect

    TextFont

    The font family applied to the text.

    Declaration
    public Font TextFont { get; set; }
    Property Value
    Type Description
    Font

    Underline

    The underline style applied to the text.

    Declaration
    public Underline Underline { get; set; }
    Property Value
    Type Description
    Underline

    Vanish

    Declaration
    public Nullable<bool> Vanish { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    VerticalPosition

    Declaration
    public Nullable<double> VerticalPosition { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Double>

    VerticalTextAlignment

    The vertical alignment of the text (superscript, subscript, or baseline).

    Declaration
    public Nullable<VerticalPositionValues> VerticalTextAlignment { get; set; }
    Property Value
    Type Description
    System.Nullable<VerticalPositionValues>

    WebHidden

    Declaration
    public Nullable<bool> WebHidden { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    Methods

    Reset()

    Resets all formatting properties to their default values.

    Declaration
    public TextStyle Reset()
    Returns
    Type Description
    TextStyle

    This TextStyle object for method chaining.

    Implements

    ITextStyle
    IronSoftware.Abstractions.Word.ITextStyle
    IDerivedStyle
    IronSoftware.Abstractions.Word.IDerivedStyle
    IronSoftware.Abstractions.Word.IStyle
    IronSoftware.Abstractions.Word.IWordDocumentObjectProperty
    IronSoftware.Abstractions.IDocumentObjectProperty
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet
    %s requires a valid license key for further deployment. Get Trial Below.
    ironsuite
    Blue key in circleGet Started for Free
    30 days full access • No credit card required
    Test in a live environment

    Test in production without watermarks.
    Works wherever you need it to.

    Fully-functional product

    Get 30 days of fully functional product.
    Have it up and running in minutes.

    24/5 technical support

    Full access to our support engineering team during your product trial

    Grey key in circleGet Started for Free
    The trial form was submitted successfully.
    Grey check in circleTrial key delivered
    Your key has been issued and sent to your email.
    Calendar in circleBook Free Live Demo
    No cards • no pitches • no commitments Pick a time for a quick, personalized demo
    Get the most out of your 30-day trial with:

    Live product and key features walk-through

    Project-specific recommendations

    All your questions answered

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation

    Want to deploy Iron Suite
    to a live project for FREE?

    What’s included?

    • Test in production without watermarks
    • 30 days fully functional product
    • 24/5 technical support during trial
    ironpdf Logo
    ironword Logo
    ironxl Logo
    ironppt Logo
    ironocr Logo
    ironbarcode Logo
    ironqr Logo
    ironprint Logo
    ironzip Logo
    ironwebscraper Logo
    Iron Software sales team
    Online 24/5
    Have Enterprise licensing requirements?
    Request Iron Suite Enterprise trial
    Key in blue circle

    Get your free 30-day Trial Key instantly

    Your trial license will be sent to your email address

    No limitations. 100% unlocked. No credit card.

    bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
    Or
    Key in blue circle

    Complete Your Trial Key Signup

    Tell us a little more about yourself.

    Key in blue circleNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
    Key in blue circle

    Your license key has been delivered to your inbox

    Can't find it? Check your spam folder.

    What’s next?
    Install with NuGet
    Add IronWord to your project
    Quickstart Guide
    Helpful resources to get started

    Need help getting started?

    Book a Free Live Demo

    See IronWord in action and get your licensing questions answered, or

    Key in blue circle

    Your demo request is in.

    You'll receive an invite via email shortly.

    What’s next?
    Explore Documentation
    Review Licensing Options
    badge_greencheck_in_yellowcircle
    Thank you
    Your trial key should be in the email.
    If it is not, please contact support@ironsoftware.com
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronWord
    Your trial key should be in the email.
    If it is not, please contact support@ironsoftware.com