GemBox.Presentation
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    TextParagraph Class

    Namespace:
    GemBox.Presentation
    Assembly:
    GemBox.Presentation.dll

    Represents a paragraph of text.

    • C#
    • VB.NET
    public sealed class TextParagraph
    Public NotInheritable Class TextParagraph
    Inheritance:
    System.Object
    TextParagraph

    Properties

    Elements

    Gets the paragraph text elements.

    • C#
    • VB.NET
    public TextElementCollection Elements { get; }
    Public ReadOnly Property Elements As TextElementCollection
    Property Value
    TextElementCollection

    The paragraph text elements.

    Format

    Gets or sets the paragraph's formatting options.

    • C#
    • VB.NET
    public TextParagraphFormat Format { get; set; }
    Public Property Format As TextParagraphFormat
    Property Value
    TextParagraphFormat

    The paragraph's formatting options.

    Remarks

    This property always returns a new instance of a TextParagraphFormat that points to data associated with this paragraph. This reduces memory footprint since simpler internal structures can be used to hold the data and execution time increase is negligible since Garbage Collector has a very good performance for a short-lived (Generation 0) objects.

    When setting a value, instance of a TextParagraphFormat won't actually be stored in this paragraph, but the data to which the instance points to will be copied. This enables easy copying of complex properties from one text element to another.

    Parent

    Gets the parent object such as a Shape or a TableCell, or null if text paragraph was deleted.

    • C#
    • VB.NET
    public object Parent { get; }
    Public ReadOnly Property Parent As Object
    Property Value
    System.Object

    The parent object such as a Shape or a TableCell, or null if text paragraph was deleted.

    Slide

    Gets the slide associated with this text paragraph.

    • C#
    • VB.NET
    public SlideObject Slide { get; }
    Public ReadOnly Property Slide As SlideObject
    Property Value
    SlideObject

    The slide associated with this text paragraph.

    TextContent

    Gets the content range of the current TextParagraph.

    • C#
    • VB.NET
    public TextRange TextContent { get; }
    Public ReadOnly Property TextContent As TextRange
    Property Value
    TextRange

    The content range of the current TextParagraph.

    Remarks

    The property always returns a new instance of the TextRange class.

    For more information, see Find and Replace example.

    Methods

    AddField(TextFieldType)

    Adds a new text field to the paragraph.

    • C#
    • VB.NET
    [ComVisible(false)]
    public TextField AddField(TextFieldType fieldType)
    <ComVisible(False)>
    Public Function AddField(fieldType As TextFieldType) As TextField
    Parameters
    fieldType
    TextFieldType

    Type of the field. Text property is set based on the field type.

    Returns
    TextField

    The text field added to the paragraph.

    AddField(String, String)

    Adds a new text field to the paragraph.

    • C#
    • VB.NET
    [ComVisible(true)]
    public TextField AddField(string fieldType, string text)
    <ComVisible(True)>
    Public Function AddField(fieldType As String, text As String) As TextField
    Parameters
    fieldType
    System.String

    Type of the field that is not supported by TextFieldType enumeration.

    text
    System.String

    The field text.

    Returns
    TextField

    The text field added to the paragraph.

    Exceptions
    System.ArgumentException

    Parameter text contains character '\v', '\r' or '\n'. Character '\v' represents a line break and a TextLineBreak instance should be added instead. Characters '\r' and '\n' represent a paragraph break and a TextParagraph instance should be added instead.

    AddLineBreak()

    Adds a new line break to the paragraph.

    • C#
    • VB.NET
    public TextLineBreak AddLineBreak()
    Public Function AddLineBreak As TextLineBreak
    Returns
    TextLineBreak

    The line break added to the paragraph.

    AddRun(String)

    Adds a new run of text to the paragraph.

    • C#
    • VB.NET
    public TextRun AddRun(string text)
    Public Function AddRun(text As String) As TextRun
    Parameters
    text
    System.String

    The text.

    Returns
    TextRun

    The run of text added to the paragraph.

    Exceptions
    System.ArgumentException

    Parameter text is either null or System.String.Empty, or it contains character '\v', '\r' or '\n'. Character '\v' represents a line break and a TextLineBreak instance should be added instead. Characters '\r' and '\n' represent a paragraph break and a TextParagraph instance should be added instead.

    ToString()

    Returns a System.String that represents this TextParagraph instance.

    • C#
    • VB.NET
    public override string ToString()
    Public Overrides Function ToString As String
    Returns
    System.String

    A System.String that represents this TextParagraph instance.

    Overrides
    System.Object.ToString()

    Examples

    Text Boxes Example
    Paragraph Formatting Example
    Find and Replace example
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.