Class TextBox

Class TextBox

Namespace: Aspose.Cells.Drawing
Assembly: Aspose.Cells.dll (25.2.0)

Encapsulates the object that represents a textbox in a spreadsheet.

public class TextBox : Shape

Inheritance

objectShapeTextBox

Inherited Members

Shape.GetResultOfSmartArt(), Shape.ToFrontOrBack(int), Shape.GetLockedProperty(ShapeLockType), Shape.SetLockedProperty(ShapeLockType, bool), Shape.AddHyperlink(string), Shape.RemoveHyperlink(), Shape.MoveToRange(int, int, int, int), Shape.AlignTopRightCorner(int, int), Shape.GetConnectionPoints(), Shape.ToImage(Stream, ImageType), Shape.ToImage(string, ImageOrPrintOptions), Shape.ToImage(Stream, ImageOrPrintOptions), Shape.GetLinkedCell(bool, bool), Shape.SetLinkedCell(string, bool, bool), Shape.GetInputRange(bool, bool), Shape.SetInputRange(string, bool, bool), Shape.UpdateSelectedValue(), Shape.CalculateTextSize(), Shape.FormatCharacters(int, int, Font, StyleFlag), Shape.Characters(int, int), Shape.GetRichFormattings(), Shape.RemoveActiveXControl(), Shape.IsSameSetting(object), Shape.GetActualBox(), Shape.MacroName, Shape.IsEquation, Shape.IsSmartArt, Shape.ZOrderPosition, Shape.Name, Shape.AlternativeText, Shape.Title, Shape.Line, Shape.Fill, Shape.ShadowEffect, Shape.Reflection, Shape.Glow, Shape.SoftEdges, Shape.ThreeDFormat, Shape.FormatPicture, Shape.IsHidden, Shape.IsAspectRatioLocked, Shape.RotationAngle, Shape.Hyperlink, Shape.Id, Shape.Spid, Shape.Spt, Shape.Worksheet, Shape.IsGroup, Shape.IsInGroup, Shape.IsWordArt, Shape.TextEffect, Shape.IsLocked, Shape.IsPrintable, Shape.MsoDrawingType, Shape.AutoShapeType, Shape.AnchorType, Shape.Placement, Shape.UpperLeftRow, Shape.UpperDeltaY, Shape.UpperLeftColumn, Shape.UpperDeltaX, Shape.LowerRightRow, Shape.LowerDeltaY, Shape.LowerRightColumn, Shape.LowerDeltaX, Shape.Right, Shape.Bottom, Shape.Width, Shape.WidthInch, Shape.WidthPt, Shape.WidthCM, Shape.Height, Shape.HeightInch, Shape.HeightPt, Shape.HeightCM, Shape.Left, Shape.LeftInch, Shape.LeftCM, Shape.Top, Shape.TopInch, Shape.TopCM, Shape.TopToCorner, Shape.LeftToCorner, Shape.X, Shape.Y, Shape.WidthScale, Shape.HeightScale, Shape.TopInShape, Shape.LeftInShape, Shape.WidthInShape, Shape.HeightInShape, Shape.Group, Shape.Type, Shape.HasLine, Shape.IsFilled, Shape.IsFlippedHorizontally, Shape.IsFlippedVertically, Shape.ActualLowerRightRow, Shape.RelativeToOriginalPictureSize, Shape.LinkedCell, Shape.InputRange, Shape.TextShapeType, Shape.TextBody, Shape.Font, Shape.TextOptions, Shape.Text, Shape.IsRichText, Shape.HtmlText, Shape.TextVerticalOverflow, Shape.TextHorizontalOverflow, Shape.IsTextWrapped, Shape.TextOrientationType, Shape.TextHorizontalAlignment, Shape.TextVerticalAlignment, Shape.TextDirection, Shape.TextBoxOptions, Shape.ControlData, Shape.ActiveXControl, Shape.Paths, Shape.Geometry, Shape.CreateId, Shape.IsDecorative, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

//Instantiate a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet in the book.
Worksheet worksheet = workbook.Worksheets[0];
//Add a new textbox to the collection.
int textboxIndex = worksheet.TextBoxes.Add(2, 1, 160, 200);
//Get the textbox object.
Aspose.Cells.Drawing.TextBox textbox0 = worksheet.TextBoxes[textboxIndex];
//Fill the text.
textbox0.Text = "ASPOSE______The .NET and JAVA Component Publisher!";
//Set the textbox to adjust it according to its contents.
textbox0.TextBody.TextAlignment.AutoSize = true;
//Set the placement.
textbox0.Placement = PlacementType.FreeFloating;
//Set the font color.
textbox0.Font.Color = Color.Blue;
//Set the font to bold.
textbox0.Font.IsBold = true;
//Set the font size.
textbox0.Font.Size = 14;
//Set font attribute to italic.
textbox0.Font.IsItalic = true;
//Add a hyperlink to the textbox.
textbox0.AddHyperlink("http://www.aspose.com/");
//Get the filformat of the textbox.
FillFormat fillformat = textbox0.Fill;
//Set the fillcolor.
fillformat.SolidFill.Color = Color.Silver;
//Get the lineformat type of the textbox.
LineFormat lineformat = textbox0.Line;
//Set the line style.
lineformat.CompoundType = MsoLineStyle.ThinThick;
//Set the line weight.
lineformat.Weight = 6;
//Set the dash style to squaredot.
lineformat.DashStyle = MsoLineDashStyle.SquareDot;
//Add another textbox.
textboxIndex = worksheet.TextBoxes.Add(15, 4, 85, 120);
//Get the second textbox.
Aspose.Cells.Drawing.TextBox textbox1 = worksheet.TextBoxes[textboxIndex];
//Input some text to it.
textbox1.Text = "This is another simple text box";
//Set the placement type as the textbox will move and
//resize with cells.
textbox1.Placement = PlacementType.MoveAndSize;
//Save the excel file.
workbook.Save("tsttextboxes.xlsx");
'Instantiate a new Workbook.
Dim workbook As Workbook = New Workbook()
'Get the first worksheet in the book.
Dim worksheet As Worksheet = workbook.Worksheets(0)
'Add a new textbox to the collection.
Dim textboxIndex As Integer = worksheet.TextBoxes.Add(2, 1, 160, 200)
'Get the textbox object.
Dim textbox0 As Aspose.Cells.Drawing.TextBox = worksheet.TextBoxes(textboxIndex)
'Fill the text.
textbox0.Text = "ASPOSE______The .NET and JAVA Component Publisher!"
'Set the textbox to adjust it according to its contents.
textbox0.TextBody.TextAlignment.AutoSize = True
'Set the placement.
textbox0.Placement = PlacementType.FreeFloating
'Set the font color.
textbox0.Font.Color = Color.Blue
'Set the font to bold.
textbox0.Font.IsBold = True
'Set the font size.
textbox0.Font.Size = 14
'Set font attribute to italic.
textbox0.Font.IsItalic = True
'Add a hyperlink to the textbox.
textbox0.AddHyperlink("http://www.aspose.com/")
'Get the filformat of the textbox.
Dim fillformat As FillFormat = textbox0.Fill
'Set the fillcolor.
fillformat.SolidFill.Color = Color.Silver
'Get the lineformat type of the textbox.
Dim lineformat As LineFormat = textbox0.Line
'Set the line style.
lineformat.CompoundType = MsoLineStyle.ThinThick
'Set the line weight.
lineformat.Weight = 6
'Set the dash style to squaredot.
lineformat.DashStyle = MsoLineDashStyle.SquareDot
'Add another textbox.
textboxIndex = worksheet.TextBoxes.Add(15, 4, 85, 120)
'Get the second textbox.
Dim textbox1 As Aspose.Cells.Drawing.TextBox = worksheet.TextBoxes(textboxIndex)
'Input some text to it.
textbox1.Text = "This is another simple text box"
'Set the placement type as the textbox will move and
'resize with cells.
textbox1.Placement = PlacementType.MoveAndSize
'Save the excel file.
workbook.Save("tsttextboxes.xlsx")

Methods

GetEquationParagraph(int)

Get the specified math paragraph from the TextBody property of the TextBox object. Notice: (1) Returns NULL when the index is out of bounds or not found. (2) Also returns NULL if the specified index position is not a math paragraph.

public EquationNode GetEquationParagraph(int index)

Parameters

index int

The position index of the math paragraph, starting from 0.

Returns

EquationNode

Returns the math paragraph specified by index.

GetEquationParagraph()

Gets the first math paragraph from the TextBody property of the TextBox object.

public EquationNode GetEquationParagraph()

Returns

EquationNode

If there has math paragraph, returns the first one, otherwise returns null.