.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

ShapeCollection.AddTextBox(Single, Single, Single, Single, String) Method

Inserts a text box.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v20.2.Core.dll


Shape AddTextBox(
    float x,
    float y,
    float width,
    float height,
    string text
Function AddTextBox(
    x As Single,
    y As Single,
    width As Single,
    height As Single,
    text As String
) As Shape


Name Type Description
x Single

A Single value indicating the distance from the left of the worksheet.

y Single

A Single value indicating the distance from the top of the worksheet.

width Single

A Single value that is the text box's width.

height Single

A Singlevalue that is the text box's height.

text String

A string value that is the text box's content.


Type Description

A Shape object that is the resulting text box.



The ISpreadsheetComponent.Unit property determines the units of linear dimensions (x, y, width, height).

The following properties help you determine whether the current Shape object is a text box:

Change the text box's fill and outline settings using the ShapeFormatBase.Fill and ShapeFormatBase.Outline properties.

Use the Shape.ShapeText property to access the shape's text options.

The Shape.Rotation property allows you to define the text box's rotation angle.

Delete the text box using the ShapeCollection.RemoveAt or Shape.Delete method.


The code sample below shows how to insert, rotate and color a text box:


Shape textBox = worksheet.Shapes.AddTextBox(50, 120, 500, 100, "Spreadsheet");
textBox.Rotation = 30;
See Also