Class WTextBox
Represents the textbox in the Word document.
Inherited Members
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
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
CreateLayoutInfo()
Creates layout information.
Declaration
protected override void CreateLayoutInfo()
Overrides
InitXDLSHolder()
Registers child objects in XDSL holder.
Declaration
protected override void InitXDLSHolder()
Overrides
WriteXmlAttributes(IXDLSAttributeWriter)
Writes object data as xml attributes.
Declaration
protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IXDLSAttributeWriter | writer | The IXDLSAttributeWriter object. |