TextBox Class |
Namespace: Aspose.Words.Drawing
The TextBox type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | FitShapeToText |
Determines whether Microsoft Word will grow the shape to fit text.
|
![]() ![]() | InternalMarginBottom |
Specifies the inner bottom margin in points for a shape.
|
![]() ![]() | InternalMarginLeft |
Specifies the inner left margin in points for a shape.
|
![]() ![]() | InternalMarginRight |
Specifies the inner right margin in points for a shape.
|
![]() ![]() | InternalMarginTop |
Specifies the inner top margin in points for a shape.
|
![]() ![]() | LayoutFlow |
Determines the flow of the text layout in a shape.
|
![]() ![]() | Next |
Returns or sets a TextBox that represents the next TextBox in a sequence of shapes.
|
![]() | Parent |
Gets a parent shape for the TextBox.
|
![]() ![]() | Previous |
Returns a TextBox that represents the previous TextBox in a sequence of shapes.
|
![]() ![]() | TextBoxWrapMode |
Determines how text wraps inside a shape.
|
![]() ![]() | VerticalAnchor |
Specifies the vertical alignment of the text within a shape.
|
Name | Description | |
---|---|---|
![]() ![]() | BreakForwardLink |
Breaks the link to the next TextBox.
|
![]() | Equals | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() ![]() | IsValidLinkTarget |
Determines whether this TextBox can be linked to the target Textbox.
|
![]() | ToString | (Inherited from Object.) |
Use the TextBox property to access text properties of a shape. You do not create instances of the TextBox class directly.
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a shape that contains a TextBox Shape textBoxShape = builder.InsertShape(ShapeType.TextBox, 150, 100); TextBox textBox = textBoxShape.TextBox; // Move the document builder to inside the TextBox and write text builder.MoveTo(textBoxShape.LastParagraph); builder.Write("Vertical text"); // Text is displayed vertically, written top to bottom textBox.LayoutFlow = LayoutFlow.TopToBottomIdeographic; // Move the builder out of the shape and back into the main document body builder.MoveTo(textBoxShape.ParentParagraph); // Insert another TextBox textBoxShape = builder.InsertShape(ShapeType.TextBox, 150, 100); textBox = textBoxShape.TextBox; // Apply these values to both these members to get the parent shape to defy the dimensions we set to fit tightly around the TextBox's text textBox.FitShapeToText = true; textBox.TextBoxWrapMode = TextBoxWrapMode.None; builder.MoveTo(textBoxShape.LastParagraph); builder.Write("Text fit tightly inside textbox"); builder.MoveTo(textBoxShape.ParentParagraph); textBoxShape = builder.InsertShape(ShapeType.TextBox, 100, 100); textBox = textBoxShape.TextBox; // Set margins for the textbox textBox.InternalMarginTop = 15; textBox.InternalMarginBottom = 15; textBox.InternalMarginLeft = 15; textBox.InternalMarginRight = 15; builder.MoveTo(textBoxShape.LastParagraph); builder.Write("Text placed according to textbox margins"); doc.Save(ArtifactsDir + "Shape.TextBox.docx");