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

    Show / Hide Table of Contents

    Run Class

    Namespace:
    GemBox.Document
    Assembly:
    GemBox.Document.dll

    Represents a region of text with a common set of properties.

    • C#
    • VB.NET
    public sealed class Run : Inline
    Public NotInheritable Class Run
        Inherits Inline
    Inheritance:
    System.Object
    Element
    Inline
    Run
    Remarks

    Run is an Inline element used to insert textual content to a document.

    Text property holds a text contained in the Run instance.

    Run can be formatted directly using the CharacterFormat property or, indirectly, using a CharacterStyle class. For more information, see character formatting example.

    Constructors

    Run(DocumentModel)

    Initializes a new instance of the Run class with empty Text.

    • C#
    • VB.NET
    public Run(DocumentModel document)
    Public Sub New(document As DocumentModel)
    Parameters
    document
    DocumentModel

    The owner document.

    Run(DocumentModel, String)

    Initializes a new instance of the Run class with specified text.

    • C#
    • VB.NET
    public Run(DocumentModel document, string text)
    Public Sub New(document As DocumentModel, text As String)
    Parameters
    document
    DocumentModel

    The owner document.

    text
    System.String

    The text for this Run instance.

    Properties

    CharacterFormat

    Gets or sets the character format.

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

    The character format.

    Remarks

    This property is defined as direct formatting, since it is directly applied to the run and supersede any formatting from styles.

    note

    If Text is System.String.Empty, then Run and its CharacterFormat won't be saved to DOCX.

    In that case, if Run is the last or the only element in the parent Paragraph, use CharacterFormatForParagraphMarkParagraph.CharacterFormatForParagraphMark

    of the parent paragraph to save character (font) formatting to DOCX.

    For more information about paragraph formatting, see character formatting example.

    CharacterFormatRevision

    Gets or sets the revision of the format of this run. This property contains the format which was applied to this run before the revision.

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

    The revision of the format of this run.

    Remarks

    The revision is internally stored as a member of CharacterFormat. Using set property on CharacterFormat overrides this revision.

    Document

    Gets the owner document.

    • C#
    • VB.NET
    public override DocumentModel Document { get; }
    Public Overrides ReadOnly Property Document As DocumentModel
    Property Value
    DocumentModel

    The owner document.

    Overrides
    Element.Document

    ElementType

    Gets the ElementType of this Element instance.

    • C#
    • VB.NET
    public override ElementType ElementType { get; }
    Public Overrides ReadOnly Property ElementType As ElementType
    Property Value
    ElementType

    The ElementType of this Element instance.

    Overrides
    Element.ElementType

    Text

    Gets or sets the text of this Run instance.

    • C#
    • VB.NET
    public string Text { get; set; }
    Public Property Text As String
    Property Value
    System.String

    The text of this Run instance.

    Remarks

    Text should not contain special characters like '\n', '\r', '\t', '\v' and '\f'. If it does, System.InvalidOperationException will be thrown. To add line breaks, page breaks, column breaks and tabs, use SpecialCharacter element.

    Methods

    Clone()

    Clones this Run instance.

    • C#
    • VB.NET
    public Run Clone()
    Public Function Clone As Run
    Returns
    Run

    Cloned Run.

    Remarks

    Document content element instance can exist only in a one place in the document.

    If you want to insert document content element into some other part of the same document, then clone the element and insert its clone.

    If you want to insert document content element into another document, then you should first import it into another document with Import<T>(T, Boolean, Boolean) method and then insert the imported element.

    For more information, see cloning example.

    Inherited Properties

    Content

    Gets the content of the current Element.

    (Inherited from Element)

    Parent

    Gets the parent of this Element instance.

    (Inherited from Element)

    ParentCollection

    Gets the InlineCollection that contains this Inline instance.

    (Inherited from Inline)

    Revision

    Gets or sets the revision information for the inline.

    (Inherited from Inline)

    Inherited Methods

    Clone(System.Boolean)

    Clones this Inline instance.

    (Inherited from Inline)

    GetChildElements(System.Boolean)

    Gets the child elements.

    (Inherited from Element)

    GetChildElements(System.Boolean, ElementType[])

    Gets the child elements filtered by ElementType.

    (Inherited from Element)

    GetParentElements()

    Gets the parent elements.

    (Inherited from Element)

    GetParentElements(ElementType[])

    Gets the parent elements.

    (Inherited from Element)

    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.