Help Center

TextArrayproperty

Returns or sets the text content of an arbitrary cell.

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 TextArray (BYVAL Index AS LONG) AS DWSTRING
PROPERTY TextArray (BYVAL Index AS LONG, BYREF wszText AS WSTRING)

Parameters

NameDescription
IndexAn integer value that specifies which cell to read or write.
wszTextThe text to set.

Description

Returns or sets the text contents of an arbitrary cell.

This property allows you to set or retrieve the contents of a cell without changing the Row and Col properties.

The Index argument determines which cell to use. It is calculated by multiplying the preferred row by the Cols property and adding the preferred column.

Remarks

While most developers use TextMatrix(Row, Col) for two-dimensional access, TextArray maps the entire grid (across all bands) into a single linear sequence.

Formula: To find the TextArray index for a specific cell, use: Constraint: You cannot change the active cell's position using this property; it only modifies the content.

Examples

Index = (Row * Cols) + Col.

' Using TextMatrix (Preferred) grid.TextMatrix(1, 1) = "Data"

' Using TextArray (One-dimensional index) ' Index = (1 * 5) + 1 = 6 grid.TextArray(6) = "Data"

FixedRows = 1 FixedCols = 1 Cols = 5

Cell (0,0) → Index = (0 * 5) + 0 = 0 Cell (0,3) → Index = (0 * 5) + 3 = 3 Cell (1,0) → Index = (1 * 5) + 0 = 5

In a grid with: The mapping is:

While TextMatrix and Text treat fixed cells specially (e.g., they don’t move the active cell), TextArray treats fixed cells exactly like any other cell in the linear sequence.

This is useful when:

  • iterating through the entire grid as a flat list
  • exporting data
  • performing bulk operations without changing the active cell
  • implementing custom copy/paste logic

But it also means that developers must account for fixed rows and columns when calculating indices manually.

Reference