Class ParagraphFormat
Represents the ParagraphFormat class.
Namespace: Syncfusion.Windows.Controls.RichTextBoxAdv
Assembly: Syncfusion.SfRichTextBoxAdv.WPF.dll
Syntax
public sealed class ParagraphFormat : BaseNode
Constructors
ParagraphFormat()
Initializes a new instance of the ParagraphFormat class.
Declaration
public ParagraphFormat()
ParagraphFormat(BaseNode)
Initializes a new instance of the ParagraphFormat class for the specified Node.
Declaration
public ParagraphFormat(BaseNode owner)
Parameters
Type | Name | Description |
---|---|---|
BaseNode | owner | The owner of the ParagraphFormat. The value can be null or an instance of DocumentAdv, ParagraphAdv, Inline or ListLevelAdv. |
Fields
AfterSpacingProperty
Identifies the AfterSpacing dependency property.
Declaration
public static readonly DependencyProperty AfterSpacingProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the AfterSpacing dependency property. |
BeforeSpacingProperty
Identifies the BeforeSpacing dependency property.
Declaration
public static readonly DependencyProperty BeforeSpacingProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the BeforeSpacing dependency property. |
BidiProperty
Identifies the Bidi dependency property.
Declaration
public static readonly DependencyProperty BidiProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the Bidi dependency property. |
FirstLineIndentProperty
Identifies the FirstLineIndent dependency property.
Declaration
public static readonly DependencyProperty FirstLineIndentProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the FirstLineIndent dependency property. |
LeftIndentProperty
Identifies the LeftIndent dependency property.
Declaration
public static readonly DependencyProperty LeftIndentProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the LeftIndent dependency property. |
LineSpacingProperty
Identifies the LineSpacing dependency property.
Declaration
public static readonly DependencyProperty LineSpacingProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the LineSpacing dependency property. |
LineSpacingTypeProperty
Identifies the LineSpacingType dependency property.
Declaration
public static readonly DependencyProperty LineSpacingTypeProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the LineSpacingType dependency property. |
ListFormatProperty
Identifies the ListFormat dependency property.
Declaration
public static readonly DependencyProperty ListFormatProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the ListFormat dependency property. |
RightIndentProperty
Identifies the RightIndent dependency property.
Declaration
public static readonly DependencyProperty RightIndentProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the RightIndent dependency property. |
TextAlignmentProperty
Identifies the TextAlignment dependency property.
Declaration
public static readonly DependencyProperty TextAlignmentProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | The identifier for the TextAlignment dependency property. |
Properties
AfterSpacing
Gets or Sets the after spacing of the ParagraphFormat.
Declaration
public double AfterSpacing { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The after spacing of the ParagraphFormat. |
Examples
The following code example demonstrates how to define the spacing before the paragraph.
<!-- Defines the spacing after the paragraph as 24 pixels. -->
<RichTextBoxAdv:ParagraphFormat AfterSpacing="24"/>
// Defines the lspacing after the paragraph as 24 pixels.
ParagraphFormat paragraphFormat = new ParagraphFormat();
paragraphFormat.AfterSpacing = 24;
' Defines the spacing after the paragraph as 96 pixels.
Dim paragraphFormat As New ParagraphFormat()
paragraphFormat.AfterSpacing = 24
BeforeSpacing
Gets or Sets the before spacing of the ParagraphFormat.
Declaration
public double BeforeSpacing { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The before spacing of the ParagraphFormat. |
Examples
The following code example demonstrates how to define the spacing before the paragraph.
<!-- Defines the spacing before the paragraph as 48 pixels. -->
<RichTextBoxAdv:ParagraphFormat BeforeSpacing="48"/>
// Defines the spacing before the paragraph as 48 pixels.
ParagraphFormat paragraphFormat = new ParagraphFormat();
paragraphFormat.BeforeSpacing = 48;
' Defines the spacing before the paragraph as 48 pixels.
Dim paragraphFormat As New ParagraphFormat()
paragraphFormat.BeforeSpacing = 48
Bidi
Gets or sets a value indicating whether the ParagraphFormat represents right-to-left reading order. The default value is false.
Declaration
public bool Bidi { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True. If right-to-left; Otherwise, false. |
Examples
The following code example demonstrates how to define right-to-left direction(bidirectional).
<!-- Defines the right-to-left direction for the paragraph. -->
<RichTextBoxAdv:ParagraphFormat Bidi="True"/>
// Defines the right-to-left direction for the paragraph.
ParagraphFormat paragraphFormat = new ParagraphFormat();
paragraphFormat.Bidi = true;
' Defines the right-to-left direction for the paragraph.
Dim paragraphFormat As New ParagraphFormat()
paragraphFormat.Bidi = True
FirstLineIndent
Gets or Sets the first line indent of the ParagraphFormat.
Declaration
public double FirstLineIndent { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The first line indent of the ParagraphFormat. |
Examples
The following code example demonstrates how to define the first line indent.
<!-- Defines the first line indent as -24 pixels. -->
<RichTextBoxAdv:ParagraphFormat FirstLineIndent="-24"/>
// Defines the first line indent as -24 pixels.
ParagraphFormat paragraphFormat = new ParagraphFormat();
paragraphFormat.FirstLineIndent = -24;
' Defines the first line indent as -24 pixels.
Dim paragraphFormat As New ParagraphFormat()
paragraphFormat.FirstLineIndent = -24
LeftIndent
Gets or Sets the left indent of the ParagraphFormat.
Declaration
public double LeftIndent { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The left indent of the ParagraphFormat. |
Examples
The following code example demonstrates how to define the left indent.
<!-- Defines the left indent as 96 pixels. -->
<RichTextBoxAdv:ParagraphFormat LeftIndent="96"/>
// Defines the left indent as 96 pixels.
ParagraphFormat paragraphFormat = new ParagraphFormat();
paragraphFormat.LeftIndent = 96;
' Defines the left indent as 96 pixels.
Dim paragraphFormat As New ParagraphFormat()
paragraphFormat.LeftIndent = 96
LineSpacing
Gets or Sets the line spacing of the ParagraphFormat.
Declaration
public double LineSpacing { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The line spacing of the ParagraphFormat. |
Examples
The following code example demonstrates how to define the line spacing.
<!-- Defines the line spacing as 24 pixels. -->
<RichTextBoxAdv:ParagraphFormat LineSpacingType="Atleast" LineSpacing="24"/>
// Defines the line spacing as 24 pixels.
ParagraphFormat paragraphFormat = new ParagraphFormat();
paragraphFormat.LineSpacingType = LineSpacingType.Atleast;
paragraphFormat.LineSpacing = 24;
' Defines the line spacing as 24 pixels.
Dim paragraphFormat As New ParagraphFormat()
paragraphFormat.LineSpacingType = LineSpacingType.Atleast
paragraphFormat.LineSpacing = 24
LineSpacingType
Gets or Sets the LineSpacingType of the ParagraphFormat.
Declaration
public LineSpacingType LineSpacingType { get; set; }
Property Value
Type | Description |
---|---|
LineSpacingType | The LineSpacingType of the ParagraphFormat. |
Examples
The following code example demonstrates how to define the line spacing type.
<!-- Defines the multiple line spacing with the value of three. -->
<RichTextBoxAdv:ParagraphFormat LineSpacingType="Multiple" LineSpacing="3"/>
// Defines the multiple line spacing with the value of three.
ParagraphFormat paragraphFormat = new ParagraphFormat();
paragraphFormat.LineSpacingType = LineSpacingType.Multiple;
paragraphFormat.LineSpacing = 3;
' Defines the multiple line spacing with the value of three.
Dim paragraphFormat As New ParagraphFormat()
paragraphFormat.LineSpacingType = LineSpacingType.Multiple
paragraphFormat.LineSpacing = 3
ListFormat
Gets or sets the ListFormat of the ParagraphFormat.
Declaration
public ListFormat ListFormat { get; set; }
Property Value
Type | Description |
---|---|
ListFormat | The ListFormat of the ParagraphFormat. |
Examples
The following code example demonstrates how to define the list format.
<!-- Defines the list format. -->
<RichTextBoxAdv:ParagraphFormat>
<RichTextBoxAdv:ParagraphFormat.ListFormat>
<RichTextBoxAdv:ListFormat ListId="3" ListLevelNumber="0"/>
</RichTextBoxAdv:ParagraphFormat.ListFormat>
</RichTextBoxAdv:ParagraphFormat>
// Defines the list format.
ParagraphFormat paragraphFormat = new ParagraphFormat();
ListFormat listFormat = new ListFormat();
listFormat.ListId = 3;
listFormat.ListLevelNumber = 0;
paragraphFormat.ListFormat = listFormat;
' Defines the list format.
Dim paragraphFormat As New ParagraphFormat()
Dim listFormat As New ListFormat()
listFormat.ListId = 3
listFormat.ListLevelNumber = 0
paragraphFormat.ListFormat = listFormat
RightIndent
Gets or Sets the right indent of the ParagraphFormat.
Declaration
public double RightIndent { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The right indent of the ParagraphFormat. |
Examples
The following code example demonstrates how to define the right indent.
<!-- Defines the right indent as 48 pixels. -->
<RichTextBoxAdv:ParagraphFormat RightIndent="48"/>
// Defines the right indent as 48 pixels.
ParagraphFormat paragraphFormat = new ParagraphFormat();
paragraphFormat.RightIndent = 48;
' Defines the right indent as 48 pixels.
Dim paragraphFormat As New ParagraphFormat()
paragraphFormat.RightIndent = 48
StyleName
Declaration
public string StyleName { get; set; }
Property Value
Type |
---|
System.String |
TextAlignment
Gets or Sets the TextAlignment of the ParagraphFormat.
Declaration
public TextAlignment TextAlignment { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.TextAlignment | The TextAlignment of the ParagraphFormat. |
Examples
The following code example demonstrates how to define the left indent.
<!-- Defines the text alignment as center. -->
<RichTextBoxAdv:ParagraphFormat TextAlignment="Center"/>
// Defines the text alignment as center.
ParagraphFormat paragraphFormat = new ParagraphFormat();
paragraphFormat.TextAlignment = TextAlignment.Center;
' Defines the text alignment as center.
Dim paragraphFormat As New ParagraphFormat()
paragraphFormat.TextAlignment = TextAlignment.Center
Methods
ApplyList(ListAdv, Int32)
Applies the specified ListAdv with the specified levelNumber
.
Declaration
public void ApplyList(ListAdv listAdv, int levelNumber)
Parameters
Type | Name | Description |
---|---|---|
ListAdv | listAdv | The ListAdv instance. |
System.Int32 | levelNumber | The level number of the ListAdv. |
Examples
The following code example demonstrates how to apply a list for the paragraph.
public void ApplyList()
{
// Retrieves the paragaph from the document.
ParagraphAdv paragraphAdv = richTextBoxAdv.Document.Sections[0].Blocks[0] as ParagraphAdv;
// Retrieves the list from the document.
ListAdv listAdv = richTextBoxAdv.Document.Lists[2];
// Applies the list for the paragraph with level number = 0.
paragraphAdv.ParagraphFormat.ApplyList(listAdv, 0);
}
Private Sub GetDocumentTextPositions()
' Retrieves the paragaph from the document.
Dim paragraphAdv As ParagraphAdv = TryCast(richTextBoxAdv.Document.Sections(0).Blocks(0), ParagraphAdv)
' Retrieves the list from the document.
Dim listAdv As ListAdv = richTextBoxAdv.Document.Lists(2)
' Applies the list for the paragraph with level number = 0.
paragraphAdv.ParagraphFormat.ApplyList(listAdv, 0)
End Sub