Help Center

Textproperty

Returns or sets the text content of a cell or range of cells.

Windowspropertydoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

PROPERTY Text () AS DWSTRING
PROPERTY Text (BYREF wszText AS WSTRING) AS HRESULT

Parameters

NameDescription
wszTextThe text to set.

Description

Returns or sets the text content of a cell or range of cells.

Remarks

When retrieving, the Text property always retrieves the contents of the current cell as defined by the Row and Col properties.

When setting, the Text property sets the contents of the current cell or selection depending on the setting of the FillStyle property.

Unlike TextMatrix, which uses row/column indices directly, the Text property always refers to whichever cell is "active" or has the current focus highlight.

If the FillStyle property is set to flexFillRepeat, assigning a value to the Text property will fill every cell within the currently selected range. By default (flexFillSingle), it only affects the active cell.

If the WordWrap property is True, long text strings assigned to this property will automatically wrap to multiple lines within the cell.

Examples

' Sets the content of the currently active cell grid.Text = "Revised Entry"

' Must move focus to the specific cell first to use .Text grid.Row = 2 grid.Col = 1 Dim cellValue As DWString cellValue = grid.Text

Reference