Search Results for

    Show / Hide Table of Contents

    Interface ITextStyle

    The styling options for text.

    Inherited Members
    IDerivedStyle.BaseStyle
    Namespace: IronWord.Models
    Assembly: IronWord.dll
    Syntax
    public interface ITextStyle : IDerivedStyle

    Formatting the characters in a Word document, the font, color, underline, and effects, runs through ITextStyle in C#. The contract gathers every text-level styling option into one place, so code that styles a run can set appearance through a single object and apply the same style to many runs. It is the text counterpart to the table styling contract ITableStyle, and it is most often used through the concrete TextStyle class.

    The concrete implementor in IronWord is TextStyle, the type a developer constructs, fills with the appearance settings, and assigns to the text being written or edited. Code usually names TextStyle directly; the interface matters when a routine accepts or returns a style by contract, or inspects DefaultStyle to read the baseline appearance. ITextStyle extends IDerivedStyle, which contributes the inherited BaseStyle member, so a text style participates in the same derived-style chain as the other styling contracts and can fall back to a base style for any value it does not set.

    The everyday members are Color (the text color, an IronWord Color), TextFont (the Font family), and the toggles Underline, Strike, and Emphasis that mark a run. Richer presentation comes from TextEffect, Shading for background fill, and VerticalTextAlignment for superscript or subscript positioning. Reset() returns a TextStyle with every property back at its default, which is the clean starting point for building a fresh style.

    ITextStyle style = new TextStyle
    {
        Color = Color.Blue,
        TextFont = new Font { FontFamily = "Calibri" },
        Underline = new Underline()
    };

    The style text how-to walks through applying styles, the style text example has a worked listing, and the add text how-to shows where styled runs are written.

    Properties

    Color

    The color of the text.

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

    DefaultStyle

    The default text style.

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

    Emphasis

    The emphasis mark style applied to the text.

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

    Shading

    The background shading applied to the text.

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

    Strike

    The strikethrough style applied to the text.

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

    TextEffect

    The special text effect applied to the text.

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

    TextFont

    The font family applied to the text.

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

    Underline

    The underline style applied to the text.

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

    VerticalTextAlignment

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

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

    Methods

    Reset()

    Resets all text style properties to their default values.

    Declaration
    TextStyle Reset()
    Returns
    Type Description
    TextStyle

    Inherited members

    BaseStyle
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet
    IronWord_for_dotnet_log2o
    Blue key in circleGet started for FREE
    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.
    Calendar in circleBook Free Live Demo
    No contact, no card details, no commitments Book a 30-minute, personal demo.
    Here's what to expect:

    A live demo of our product and its key features

    Get project specific feature recommendations

    All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation
    Support Team Member 6 related to The C# PDF Library Support Team Member 14 related to The C# PDF Library Support Team Member 4 related to The C# PDF Library Support Team Member 2 related to The C# PDF Library
    Online 24/5
    Need help? Our sales team would be glad to help you.
    Try the Enterprise Trial
    ironpdf_for_dotnet_log2o
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    bullet_checkedNo credit card or account creation required
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    Blue key in circleNo credit card or account creation required
    Green Check in orange circle
    The trial form was submitted successfully.
    badge_greencheck_in_yellowcircle
    Thank you for starting a trial

    Please check your email for the trial license key.

    If you don’t receive an email, please start a live chat or email support@ironsoftware.com

    Install with NuGet
    View Licensing
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronWord