TX Text Control .NET for Windows Forms

ParagraphFormat Class

Class
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.dll
Install
dotnet add package TXTextControl.TextControl.WinForms.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.

Description

An instance of the ParagraphFormat class represents the formatting attributes of a paragraph.

Syntax

public class ParagraphFormat

Examples

The following example shows how to add a specific paragraph format to the current paragraph. The text will be centered and a boxed frame is displayed.

TXTextControl.ParagraphFormat format = new TXTextControl.ParagraphFormat();
format.Alignment = TXTextControl.HorizontalAlignment.Center;
format.Frame = TXTextControl.Frame.Box;
format.FrameStyle = TXTextControl.FrameStyle.Double;

textControl1.Selection.ParagraphFormat = format;

The following example applies paragraph layout to selected report text.

textControl.Text = "First item\nSecond item\nThird item";
textControl.Select(0, textControl.Text.Length);
ParagraphFormat paragraphFormat = textControl.Selection.ParagraphFormat;
textControl.Selection.ParagraphFormat = paragraphFormat;

Members

Constructors

ConstructorDescription
ParagraphFormatCreates a new instance of the ParagraphFormat class.

Properties

PropertyDescription
AbsoluteLineSpacingGets or sets the line spacing of a paragraph in twips.
AlignmentGets or sets the horizontal text alignment.
BackColorGets or sets the background color of a paragraph. If the background color is transparent, the paragraph's background is the same as the control's background color.
BottomDistanceGets or sets the bottom distance, in twips, between this and the next paragraph.
DirectionGets or sets the writing direction. A paragraph's writing direction can be either left to right or right to left.
FrameGets or sets a frame around the paragraph.
FrameDistanceGets or sets the distance, in twips, between the text and the paragraph's frame.
FrameLineColorGets or sets the color used for the frame lines of a paragraph.
FrameLineWidthGets or sets the line width, in twips, of the paragraph's frame.
FrameStyleGets or sets the style of the paragraph's frame.
HangingIndentGets or sets the distance, in twips, for the hanging indent. A negative value indicates an additional indent of the paragraph's first line.
JustificationGets or sets the kind of justification in documents containing Arabic or Hebrew characters. If a paragraph is justified, the additional space to justify the line is added to the spaces between the words. If the line contains Arabic or Hebrew characters the line can also be justified though the insertion of Kashida lines.
KeepLinesTogetherGets or sets a value indicating whether a page break is allowed within the paragraph. If the property's value is true, a page break is not allowed. Otherwise, it is allowed.
KeepWithNextIf this property is set to true, the paragraph is displayed on the same page as its following paragraph.
LeftIndentGets or sets the distance, in twips, between the left edge of the Text Control and the left edge of the text.
LineSpacingSpecifies the line spacing of a paragraph as a percentage of the font size.
PageBreakBeforeIf this property is set to true, the paragraph is always displayed on top of a page.
RightIndentGets or sets the distance, in twips, between the right edge of a Text Control document and the right edge of the text.
StructureLevelGets or sets the structure level of a paragraph in the document. The level can be between 0 and 10. A level of 0 indicates that the paragraph belongs to the body of the document.
TabLeadersGets or sets an array containing the tab leaders in a paragraph. A tab leader defines how a tab gap is filled.
TabPositionsGets or sets an array containing the absolute tab stop positions, in twips, in a paragraph.
TabTypesGets or sets an array containing the tab types in a paragraph.
TopDistanceGets or sets a top distance, in twips, between this and the previous paragraph.
WidowOrphanLinesGets or sets the number of lines for widow/orphan control. Widow/orphan control avoids that a paragraph is started at the bottom of a page and that either, the majority of its lines, or only a few lines are displayed on the next page. This property's value determines how many lines must not be separated from the rest of the paragraph. For example, if this property is set to two, there must be at least three lines of the paragraph at the bottom of the previous page and at least three lines at the top of the next page. Otherwise, the complete paragraph is displayed on the next page. If this property is set to zero, widow/orphan control is disabled.

Methods

MethodDescription
ResetBackColorNot described in the reference. public void ResetBackColor();
ResetFrameLineColorNot described in the reference. public void ResetFrameLineColor();
ResetTabLeadersNot described in the reference. public void ResetTabLeaders();
ResetTabPositionsNot described in the reference. public void ResetTabPositions();
ResetTabTypesNot described in the reference. public void ResetTabTypes();

Fields

FieldDescription
MaxLevelNot described in the reference. public const int MaxLevel = 10;
MaxTabsRepresents the maximum number of tabs in a line. The value of this constant is 14.

Enumerations

EnumerationDescription
AttributeDetermines a certain paragraph format attribute. This enumeration is used with the Selection.IsCommonValueSelected method. It contains the following values: