Interface ITextStyle
The styling options for text.
Inherited Members
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 |