menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class WTextBox - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class WTextBox

    Represents the textbox in the Word document.

    Inheritance
    System.Object
    OwnerHolder
    XDLSSerializableBase
    Entity
    WidgetBase
    ParagraphItem
    WTextBox
    Implements
    IXDLSSerializable
    IOfficeRun
    IWTextBox
    IParagraphItem
    ICompositeEntity
    IEntity
    Inherited Members
    Entity.Clone()
    Entity.IsComposite
    Entity.NextSibling
    Entity.Owner
    Entity.PreviousSibling
    OwnerHolder.Document
    OwnerHolder.m_doc
    ParagraphItem.ApplyStyle(String)
    ParagraphItem.CloneRun()
    ParagraphItem.Dispose()
    ParagraphItem.IsDeleteRevision
    ParagraphItem.IsInsertRevision
    ParagraphItem.m_charFormat
    ParagraphItem.OwnerMathRunElement
    ParagraphItem.OwnerParagraph
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    XDLSSerializableBase.IXDLSSerializable.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.IXDLSSerializable.RestoreReference(String, Int32)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.IXDLSSerializable.XDLSHolder
    XDLSSerializableBase.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.RestoreReference(String, Int32)
    XDLSSerializableBase.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.XDLSHolder
    Namespace: Syncfusion.DocIO.DLS
    Assembly: Syncfusion.DocIO.Base.dll
    Syntax
    public class WTextBox : ParagraphItem, IXDLSSerializable, IOfficeRun, IWTextBox, IParagraphItem, ICompositeEntity, IEntity, ILeafWidget, IWidget
    Examples
    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Create a new Word document 
        WordDocument document = new WordDocument();
        //Add new section to the document
        IWSection section = document.AddSection();
        //Add new paragraph to the section
        IWParagraph paragraph = section.AddParagraph();
        //Append new textbox to the paragraph
        IWTextBox textbox = paragraph.AppendTextBox(150, 75);
        //Add new text to the textbox body
        IWParagraph textboxParagraph = textbox.TextBoxBody.AddParagraph();
        textboxParagraph.AppendText("Text inside text box");
        textboxParagraph = textbox.TextBoxBody.AddParagraph();
        //Add new picture to textbox body
        IWPicture picture = textboxParagraph.AppendPicture(Image.FromFile(@"Image.png"));
        picture.Height = 75;
        picture.Width = 50;
        //Save and close the Word document
        document.Save("Sample.docx", FormatType.Docx);
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        'Create a new Word document 
        Dim document As New WordDocument()
        'Add new section to the document
        Dim section As IWSection = document.AddSection()
        'Add new paragraph to the section
        Dim paragraph As IWParagraph = section.AddParagraph()
        'Append new textbox to the paragraph
        Dim textbox As IWTextBox = paragraph.AppendTextBox(150, 75)
        'Add new text to the textbox body
        Dim textboxParagraph As IWParagraph = textbox.TextBoxBody.AddParagraph()
        textboxParagraph.AppendText("Text inside text box")
        textboxParagraph = textbox.TextBoxBody.AddParagraph()
        'Add new picture to textbox body
        Dim picture As IWPicture = textboxParagraph.AppendPicture(Image.FromFile("Image.png"))
        picture.Height = 75
        picture.Width = 50
        'Save and close the Word document
        document.Save("Sample.docx", FormatType.Docx)
        document.Close()
    End Sub

    Constructors

    WTextBox(IWordDocument)

    Initialize a new instance of the WTextBox class with the specified IWordDocument instance.

    Declaration
    public WTextBox(IWordDocument doc)
    Parameters
    Type Name Description
    IWordDocument doc

    The IWordDocument instance.

    Fields

    m_txbxFormat

    Declaration
    protected WTextBoxFormat m_txbxFormat
    Field Value
    Type
    WTextBoxFormat

    Properties

    ChildEntities

    Gets the child elements of the text box. Read-only.

    Declaration
    public EntityCollection ChildEntities { get; }
    Property Value
    Type Description
    EntityCollection

    The collection of child elements.

    EntityType

    Gets the type of the entity. Read-only.

    Declaration
    public override EntityType EntityType { get; }
    Property Value
    Type Description
    EntityType

    The EntityType of the current item.

    Overrides
    Entity.EntityType

    Name

    Gets or sets the name of the text box.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    System.String

    The string that represents the name.

    TextBoxBody

    Gets the text body of the text box. Read-only.

    Declaration
    public WTextBody TextBoxBody { get; }
    Property Value
    Type
    WTextBody

    TextBoxFormat

    Gets or sets the text box format.

    Declaration
    public WTextBoxFormat TextBoxFormat { get; set; }
    Property Value
    Type
    WTextBoxFormat

    Visible

    Gets or sets a value indicating whether this WTextBox is visible.

    Declaration
    public bool Visible { get; set; }
    Property Value
    Type Description
    System.Boolean

    True if visible; otherwise, false.

    Methods

    CloneImpl()

    Creates a duplicate copy of the entity.

    Declaration
    protected override object CloneImpl()
    Returns
    Type Description
    System.Object

    A reference to the newly created object.

    Overrides
    ParagraphItem.CloneImpl()

    CreateLayoutInfo()

    Creates layout information.

    Declaration
    protected override void CreateLayoutInfo()
    Overrides
    WidgetBase.CreateLayoutInfo()

    InitXDLSHolder()

    Registers child objects in XDSL holder.

    Declaration
    protected override void InitXDLSHolder()
    Overrides
    XDLSSerializableBase.InitXDLSHolder()

    WriteXmlAttributes(IXDLSAttributeWriter)

    Writes object data as xml attributes.

    Declaration
    protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
    Parameters
    Type Name Description
    IXDLSAttributeWriter writer

    The IXDLSAttributeWriter object.

    Overrides
    XDLSSerializableBase.WriteXmlAttributes(IXDLSAttributeWriter)

    Implements

    IXDLSSerializable
    IOfficeRun
    IWTextBox
    IParagraphItem
    ICompositeEntity
    IEntity
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved