TX Text Control .NET for WPF

ParagraphStyle Class

Class|Introduced in 10.1
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.dll
Install
dotnet add package TXTextControl.TextControl.WPF.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Inherits
  1. FormattingStyle
  2. ParagraphStyle

Description

The ParagraphStyle class defines a formatting style for paragraphs. In addition to the properties described here, it inherits all properties and methods of the FormattingStyle class.

Syntax

public sealed class ParagraphStyle : FormattingStyle

Examples

The following example shows how to add and apply a ParagraphStyle.

textControl1.Text = "TX Text Control";

TXTextControl.ParagraphStyle par = new TXTextControl.ParagraphStyle("CenterBold");
par.Bold = true;
par.ParagraphFormat.Alignment = TXTextControl.HorizontalAlignment.Center;
textControl1.ParagraphStyles.Add(par);

textControl1.Select(0,0);
textControl1.Selection.FormattingStyle = "CenterBold";

The following example creates and configures a reusable paragraph style for the document.

ParagraphStyle paragraphStyle = new("ReportHeading");
textControl.ParagraphStyles.Add(paragraphStyle);

Members

Constructors

ConstructorDescription
ParagraphStyleCreates a new instance of the ParagraphStyle class.

Properties

PropertyDescription
AutoBaselineGets or sets values specifying automatic sub- or superscripted text. When using automatic sub- and superscript the font is scaled and moved above or below the baseline with values defined through the font itself. Automatic sub- and superscript can be combined with a user-defined baseline which can be set with the Baseline property. (Inherited from FormattingStyle.)
BaselineGets or sets a user-defined baseline alignment, in twips, of the style. Positive values moves the baseline to superscript, negative values move the baseline to subscript. (Inherited from FormattingStyle.)
BaseStyleGets the FormattingStyle which is the base style of this style. If this style is the TextControl's root style this property returns null. The property's value can be either a ParagraphStyle or an InlineStyle. (Inherited from FormattingStyle.)
BoldGets or sets the bold attribute of the style. (Inherited from FormattingStyle.)
CapitalsGets or sets values specifying wheather lowercase letters are displayed with capital letters. Lowercase letters are displayed either with capital letters of the same size or with capital letters which have a smaller size. The smaller size is either the size of the lowercase 'x' (petite caps) or the size of the lowercase 'x' + 10% (small caps). (Inherited from FormattingStyle.)
CharacterScalingGets or sets the style's character scaling, in percent of the average character width. (Inherited from FormattingStyle.)
CharacterSpacingGets or sets the style's character spacing value, in twips. This value is added to each character. When it is negative, character spacing is reduced, otherwise it is extended. (Inherited from FormattingStyle.)
CultureGets or sets the style's culture. When this property is null, the style has the neutral culture. (Inherited from FormattingStyle.)
FollowingStyleGets or sets the name of the style that TextControl automatically selects for the following paragraph after the user has pressed the ENTER key.
FontNameGets or sets the font of the style. (Inherited from FormattingStyle.)
FontSizeGets or sets the font's size of the style. (Inherited from FormattingStyle.)
ForeColorGets or sets the style's color used to display the text. (Inherited from FormattingStyle.)
ItalicGets or sets the italic attribute of the style. (Inherited from FormattingStyle.)
ListFormatGets or sets the style's bulleted or numbered list and/or its formatting attributes. The property's value is an object of the type ListFormat.
NameGets or sets the name of the style. (Inherited from FormattingStyle.)
ParagraphFormatGets or sets the style's paragraph attributes. The property's value is an object of the type ParagraphFormat.
StrikeoutGets or sets the strikeout attribute of the style. (Inherited from FormattingStyle.)
TextBackColorGets or sets the style's text background color. (Inherited from FormattingStyle.)
UnderlineGets or sets underlining styles for the style. (Inherited from FormattingStyle.)

Methods

MethodDescription
ApplyApplies all set attributes of the style to the current document. (Inherited from FormattingStyle.)