ParagraphFormat Class
Represents a set of paragraph formatting properties which shall be applied to the contents of the parent paragraph.
public sealed class ParagraphFormat : Format
Public NotInheritable Class ParagraphFormat
Inherits Format
- Inheritance:
- System.ObjectParagraphFormat
Remarks
GemBox.Document supports a variety of paragraph formatting options like alignment, borders, spacing, indentation, tabs and many others.
ParagraphFormat can be set on:- Paragraph element;
- ParagraphStyle style;
- DefaultParagraphFormat property.
For more information about ParagraphFormat properties, see paragraph formatting example.
Constructors
ParagraphFormat()
Initializes a new instance of the ParagraphFormat class.
Properties
Alignment
Gets or sets the text alignment for the paragraph.
public HorizontalAlignment Alignment { get; set; }
Public Property Alignment As HorizontalAlignment
Property Value
The text alignment for the paragraph.
Remarks
If RightToLeft or RightToLeft are true, Left will be rendered as Right and Right will be rendered as Left.
BackgroundColor
Gets or sets the paragraph background color.
Property Value
The background color.
Borders
Gets the paragraph borders.
Property Value
The paragraph borders.
See Also
KeepLinesTogether
When true, all lines for this paragraph are maintained on a single page whenever possible.
Property Value
- System.Boolean
true if all lines for this paragraph are maintained on a single page; otherwise, false.
KeepWithNext
When true, the paragraph is on the same page as the following paragraph whenever possible.
Property Value
- System.Boolean
true when keep with next paragraph; otherwise, false.
LeftIndentation
Gets or sets (in points) the left indentation for the paragraph.
Property Value
- System.Double
The left indentation in points.
LineSpacing
Gets or sets the line spacing.
Property Value
- System.Double
The line spacing.
Remarks
If LineSpacingRule is Multiple then this value is in the number of lines, otherwise it is in the points.
LineSpacingRule
Gets or sets the line spacing rule.
public LineSpacingRule LineSpacingRule { get; set; }
Public Property LineSpacingRule As LineSpacingRule
Property Value
The line spacing rule.
MirrorIndents
Gets or sets whether the paragraph indents should be interpreted as mirrored indents.
Property Value
- System.Boolean
true if paragraph indents should be interpreted as mirrored indents; otherwise, false.
Remarks
When this property is true then the left indent shall become the inside indent and the right indent shall become the outside indent.
NoSpaceBetweenParagraphsOfSameStyle
When true, spacing between paragraphs with the same style will be ignored.
public bool NoSpaceBetweenParagraphsOfSameStyle { get; set; }
Public Property NoSpaceBetweenParagraphsOfSameStyle As Boolean
Property Value
- System.Boolean
true if spacing between paragraphs with the same style will be ignored; otherwise, false.
OutlineLevel
Gets or sets the outline level.
Property Value
The outline level.
PageBreakBefore
When true, this paragraph is rendered on the start of a new page in the document.
Property Value
- System.Boolean
true if page break needs to be added before paragraph; otherwise, false.
RightIndentation
Gets or sets (in points) the right indentation for the paragraph.
Property Value
- System.Double
The right indentation in points.
RightToLeft
When true, this is a right-to-left paragraph.
Property Value
- System.Boolean
true if this is right-to-left paragraph; otherwise, false.
SpaceAfter
Gets or sets the amount of spacing after the paragraph (in points).
Property Value
- System.Double
The space after.
SpaceBefore
Gets or sets the amount of spacing before the paragraph (in points).
Property Value
- System.Double
The space before.
SpecialIndentation
Gets or sets the special indentation for the paragraph.
Property Value
- System.Double
The special indentation in points.
Remarks
This values is positive for Hanging indentation and it's negative for First line indentation.
Style
Gets or sets the style.
Property Value
The style.
SuppressLineNumbers
Gets or sets a value indicating whether the line numbers should be suppressed for the paragraph.
Property Value
- System.Boolean
true, if line numbers should be suppressed; otherwise, false.
Tabs
Gets the TabStops collection.
Property Value
The TabStops collection.
Remarks
Creating customized tabs in a document is accomplished with TabStop structure that enables you to define tab position, tab leader character and surrounding text alignment.
TabStops should be inserted into Tabs collection to be used in a Paragraph.
Tabs are inserted into a document content with SpecialCharacter elements that have CharacterType property equal to Tab.
Values Bar and List are currently not supported in PDF, XPS and image file formats.
See Also
WidowControl
When true, this will prevent a single line of the paragraph from being displayed on a separate page from the remaining content.
Property Value
- System.Boolean
true if single line will be prevented from displaying on a separate page from the remaining content; otherwise, false.
WordWrap
Gets or sets a value indicating whether to break text which exceeds the text extents of a line by moving the word to the new line or breaking the word on the character level.
Property Value
- System.Boolean
true, to break text on the word level; false to break text on the character level.
Methods
ClearFormatting()
Clears the formatting.
Overrides
Remarks
This method will clear all directly set formatting values. When retrieving formatting value, they can still come from other sources, as explained in formats and styles article.
Clone()
Clones this ParagraphFormat instance.
Returns
Cloned ParagraphFormat.
Clone(Boolean)
Clones this ParagraphFormat instance.
public ParagraphFormat Clone(bool resolveValues)
Public Function Clone(resolveValues As Boolean) As ParagraphFormat
Parameters
resolveValues
- System.Boolean
If true, the values to be cloned will be fetched from this object's resolved values. This means that even if a property was never explicitly set, this method will look into this format style or in the document's default formats to resolve the values and explicitly set them in the cloned object.
Returns
Cloned ParagraphFormat.
Equals(Object)
Determines whether the specified System.Object is equal to this ParagraphFormat instance.
public override bool Equals(object obj)
Public Overrides Function Equals(obj As Object) As Boolean
Parameters
obj
- System.Object
The System.Object to compare with this paragraph format instance.
Returns
- System.Boolean
true if the specified System.Object is a ParagraphFormat and is equal to this ParagraphFormat instance; otherwise, false.
Overrides
GetHashCode()
Returns a hash code for this ParagraphFormat instance.
Returns
- System.Int32
An integer value that specifies a hash value for this ParagraphFormat instance.
Overrides
Operators
Equality(ParagraphFormat, ParagraphFormat)
Determines whether first
and second
ParagraphFormats are equal.
public static bool operator ==(ParagraphFormat first, ParagraphFormat second)
Public Shared Operator =(first As ParagraphFormat, second As ParagraphFormat) As Boolean
Parameters
first
- ParagraphFormat
The first paragraph format.
second
- ParagraphFormat
The second paragraph format.
Returns
- System.Boolean
true if first
and second
paragraph formats are equal; otherwise, false.
Inequality(ParagraphFormat, ParagraphFormat)
Determines whether first
and second
ParagraphFormats are not equal.
public static bool operator !=(ParagraphFormat first, ParagraphFormat second)
Public Shared Operator <>(first As ParagraphFormat, second As ParagraphFormat) As Boolean
Parameters
first
- ParagraphFormat
The first paragraph format.
second
- ParagraphFormat
The second paragraph format.
Returns
- System.Boolean
true if first
and second
paragraph formats are not equal; otherwise, false.
Inherited Properties
Document | Gets the owner document. (Inherited from Format) |