Skip to main content
A newer version of this page is available. .
Row

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

Inserts a text box.

Namespace: DevExpress.Spreadsheet

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

Declaration

Shape AddTextBox(
    float x,
    float y,
    float width,
    float height,
    string text
)

Parameters

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.

Returns

Type Description
Shape

A Shape object that is the resulting text box.

Remarks

Note

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.

Example

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

Spreadsheet_AddTextBox

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