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

    Show / Hide Table of Contents

    TextBox Class

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

    Represents a Shape which serves as a container for Block elements which are outside page main content flow.

    • C#
    • VB.NET
    public sealed class TextBox : Shape, IContentElement
    Public NotInheritable Class TextBox
        Inherits Shape
        Implements IContentElement
    Inheritance:
    System.Object
    Element
    Inline
    DrawingElement
    Shape
    TextBox
    Implements
    IContentElement
    Remarks

    TextBox is a content Element consisting of Block derived elements (Paragraphs and Tables).

    TextBox's shape type (geometry) is represented by ShapeType enumeration. It can be set only through TextBox(DocumentModel, Layout, ShapeType) constructor and retrieved from ShapeType property.

    TextBox can be filled with a Brush and outlined with a Pen.

    TextBox can be positioned in-line with the rest of the document content or floating within document content. For more information, see remarks for Layout property.

    Imported text frames are converted to TextBox and will be exported back as text frames, if there were no changes to the following properties: AdjustValues, Metadata or TextBoxFormat. Any changes to those properties will result in a text frame being exported as a TextBox.

    Constructors

    TextBox(DocumentModel, Layout)

    Initializes a new instance of empty TextBox with specified layout (position and size).

    • C#
    • VB.NET
    public TextBox(DocumentModel document, Layout layout)
    Public Sub New(document As DocumentModel, layout As Layout)
    Parameters
    document
    DocumentModel

    The owner document.

    layout
    Layout

    The text-box layout (position and size).

    Exceptions
    System.ArgumentNullException

    layout is null.

    TextBox(DocumentModel, Layout, Block[])

    Initializes a new instance of the TextBox class with specified layout (position and size) and content.

    • C#
    • VB.NET
    public TextBox(DocumentModel document, Layout layout, params Block[] blocks)
    Public Sub New(document As DocumentModel, layout As Layout, ParamArray blocks As Block())
    Parameters
    document
    DocumentModel

    The owner document.

    layout
    Layout

    The text-box layout (position and size).

    blocks
    Block[]

    The text-box content.

    Exceptions
    System.ArgumentNullException

    layout is null.

    TextBox(DocumentModel, Layout, ShapeType)

    Initializes a new instance of empty TextBox with specified layout (position and size) and shape type.

    • C#
    • VB.NET
    public TextBox(DocumentModel document, Layout layout, ShapeType shapeType)
    Public Sub New(document As DocumentModel, layout As Layout, shapeType As ShapeType)
    Parameters
    document
    DocumentModel

    The owner document.

    layout
    Layout

    The text-box layout (position and size).

    shapeType
    ShapeType

    The text-box shape type.

    Exceptions
    System.ArgumentNullException

    layout is null.

    TextBox(DocumentModel, Layout, IEnumerable<Block>)

    Initializes a new instance of the TextBox class with specified layout (position and size) and content.

    • C#
    • VB.NET
    public TextBox(DocumentModel document, Layout layout, IEnumerable<Block> blocks)
    Public Sub New(document As DocumentModel, layout As Layout, blocks As IEnumerable(Of Block))
    Parameters
    document
    DocumentModel

    The owner document.

    layout
    Layout

    The text-box layout (position and size).

    blocks
    System.Collections.Generic.IEnumerable<Block>

    The text-box content.

    Exceptions
    System.ArgumentNullException

    layout is null.

    System.ArgumentNullException

    blocks is null.

    Properties

    Blocks

    Gets the block elements that represent content of this TextBox instance.

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

    The block elements that represent content of this TextBox instance.

    Remarks

    Supports Paragraph and Table elements.

    ElementType

    Gets the element type for TextBox which is TextBox.

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

    The TextBox value.

    Overrides
    Shape.ElementType

    TextBoxFormat

    Gets the text box format.

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

    The text box format.

    Methods

    Clone(Boolean)

    Clones this TextBox instance.

    • C#
    • VB.NET
    public TextBox Clone(bool cloneDescendants)
    Public Function Clone(cloneDescendants As Boolean) As TextBox
    Parameters
    cloneDescendants
    System.Boolean

    If set to true clone all descendants recursively; otherwise clone only current TextBox.

    Returns
    TextBox

    Cloned TextBox.

    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

    AdjustValues

    Gets the shape's adjust values.

    (Inherited from Shape)

    CharacterFormat

    Gets or sets the character format.

    (Inherited from DrawingElement)

    Content

    Gets the content of the current Element.

    (Inherited from Element)

    Document

    Gets the owner document.

    (Inherited from Element)

    Fill

    Gets the Brush that specifies how the shape's interior is filled.

    (Inherited from Shape)

    Hidden

    Gets or sets a value indicating whether this DrawingElement is hidden.

    Default value is false.

    (Inherited from DrawingElement)

    Layout

    Gets or sets the DrawingElement layout (position and size).

    (Inherited from DrawingElement)

    Metadata

    Gets the metadata (non-visual properties) of this DrawingElement instance.

    (Inherited from DrawingElement)

    Outline

    Gets the Pen that specifies the shape's outline.

    (Inherited from Shape)

    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)

    ShapeType

    Gets the type of the shape.

    (Inherited from Shape)

    Inherited Methods

    FormatDrawing()

    Formats this DrawingElement to its default size so it can be exported to PDF, XPS, image or be printed.

    (Inherited from DrawingElement)

    FormatDrawing(System.Double, System.Double, LengthUnit)

    Formats this DrawingElement to specified size so it can be exported to PDF, XPS, image or be printed.

    (Inherited from DrawingElement)

    FormatDrawing(System.Double, System.Double, LengthUnit, PaginatorOptions)

    Formats this DrawingElement to specified size so it can be exported to PDF, XPS, image or be printed.

    (Inherited from DrawingElement)

    FormatDrawing(PaginatorOptions)

    Formats this DrawingElement to its default size so it can be exported to PDF, XPS, image or be printed.

    (Inherited from DrawingElement)

    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)

    Implements

    IContentElement

    Examples

    Text Boxes example
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.