Help Center

WordWrapproperty

Returns or sets a value that determines whether a cell displays multiple lines of text or one long line of text.

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 WordWrap () AS BOOLEAN
PROPERTY WordWrap (BYVAL bWrap AS BOOLEAN)

Parameters

NameDescription
bWrapTrueThe cell text displays with multiple, wrapping lines of text.
False: The cell text displays as one long line of text. This is the default.

Description

Returns or sets a value that determines whether a cell displays multiple lines of text or one long line of text.

Remarks

This property determines whether the grid automatically breaks long strings containing spaces into multiple lines within a cell.

The MSHFlexGrid displays text slightly faster when WordWrap is set to False.

A critical legacy behavior is that setting WordWrap = True does not automatically increase the row height to fit the wrapped text.

To actually see the wrapped text, you must manually increase the RowHeight property for the affected rows.

Strings containing manual line breaks (like CHR(13, 10)) will always wrap to multiple lines regardless of the WordWrap setting, provided the row is tall enough.

Example

grid.WordWrap = True grid.TextMatrix(1, 1) = "This is a long string that will wrap." ' Manually set a taller row height to display the wrapped content grid.RowHeight(1) = 600

Reference