Class Underline
Represents the underline formatting applied to text in a Word document.
Inheritance
Namespace: IronWord.Models
Assembly: IronWord.dll
Syntax
public class Underline : Object
When a run of text needs an underline, whether a plain single rule or a styled, colored line, Underline describes it. It captures both the line style and its color in one object, so you decide what the underline looks like and let the run's style carry it onto the page.
An Underline reaches text through TextStyle, which exposes an Underline property. Assign a configured instance there and any run formatted with that style gains the underline. You can build one with the default constructor and set properties individually, or use the constructor that takes the line style, the colors, and the theme values together when you have all the details up front.
The line style itself is LineValue, a nullable UnderlineValues that selects a single, double, dotted, or wavy rule (leave it unset for no explicit underline). Color sets a direct color for the line, while ThemeColor, ThemeShade, and ThemeTint tie it to the document theme so the underline tracks theme changes the way themed text does. Use a direct Color for a fixed look or the theme properties when the underline should follow the document's palette. Clone returns a copy, which is convenient when several runs share an underline that differs only in color, letting you duplicate the base and adjust one property. Configure the line, assign it to a TextStyle, and the underline renders when the document is saved.
using IronWord.Models;
var underline = new Underline();
underline.LineValue = UnderlineValues.Single;
underline.Color = Color.Black;The style text how-to applies underlines and other formatting, the styled text example shows formatting in code, and the add text how-to places the underlined runs in a document.
Constructors
Underline()
Initializes a new instance of the Underline class with default values.
Declaration
public Underline()
Underline(UnderlineValues, Color, Color, Int32, Double)
Initializes a new instance of the Underline class with the specified parameters.
Declaration
public Underline(UnderlineValues val, Color color, Color themeColor, int themeShade, double themeTint)
Parameters
| Type | Name | Description |
|---|---|---|
| UnderlineValues | val | The style of the underline. |
| Color | color | The color of the underline. |
| Color | themeColor | The theme color of the underline. |
| System.Int32 | themeShade | The shade of the theme color used for the underline. |
| System.Double | themeTint | The tint of the theme color used for the underline. |
Properties
Color
Gets or sets the color of the underline.
Declaration
public Color Color { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
LineValue
Gets or sets the style of the underline.
Declaration
public Nullable<UnderlineValues> LineValue { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<UnderlineValues> |
ThemeColor
Gets or sets the theme color of the underline.
Declaration
public Color ThemeColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
ThemeShade
Gets or sets the shade of the theme color used for the underline.
Declaration
public Nullable<int> ThemeShade { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.Int32> |
ThemeTint
Gets or sets the tint of the theme color used for the underline.
Declaration
public Nullable<double> ThemeTint { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.Double> |
Methods
Clone()
Creates a copy of this Underline object.
Declaration
public Underline Clone()
Returns
| Type | Description |
|---|---|
| Underline | A new Underline object with the same property values. |