Share via


MergeCells Property (ModHFGrid)

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Returns or sets a value that determines whether cells with the same contents should be grouped in a single cell spanning multiple rows or columns.

Syntax

object.MergeCells [=value]

The MergeCells property syntax has these parts:

Part Description
object An object expression that evaluates to the ModHFGrid Control object.
value An integer or constant that specifies the grouping (merging) of cells, as specified in Settings.

Settings

The settings for value are:

Constant Value Description
flexMergeNever 0 Never. The cells containing identical content are not grouped. This is the default.
flexMergeFree 1 Free. Cells with identical content always merge.
flexMergeRestrictRows 2 Restrict Rows. Only adjacent cells (to the left of the current cell) within the row containing identical content merge.
flexMergeRestrictColumns 3 Restrict Columns. Only adjacent cells (to the top of the current cell) within the column containing identical content merge.
flexMergeRestrictBoth 4 Restrict Both. Only adjacent cells within the row (to the left) or column (to the top) containing identical content merge.

Remarks

The ability to merge cells makes it possible for you to present data in a clear, concise manner. You can use cell merging in conjunction with the sorting and column order functions of the ModHFGrid.

To use the cell merging capabilities of the ModHFGrid:

  • Set MergeCells to a value other than 0. (The difference between the settings is explained in the example.)
  • Set the MergeRow and MergeCol array properties to True for the rows and columns to be merged.

When using the cell merging capabilities, the ModHFGrid merges cells with identical content. The merging is updated automatically whenever the cell content changes.

When MergeCells is set to a value other than 0 (Never), selection highlighting is turned off automatically. This is done to speed up repainting and because selection of ranges containing merged cells might lead to unexpected results.

Example

The following example shows the basic MergeCells property.

No Merging
MergeCells =0
MergeRow(0) =True
MergeRow(1) =True
MergeRow(2) =True
MergeRow(3) =False

This is the regular view.

Aa190827.deflexgridmergecellspropertyexamplenomerging(en-us,office.10).gif
Free Merging
MergeCells =1
MergeRow(0) =True
MergeRow(1) =True
MergeRow(2) =True
MergeRow(3) =False

Notice how the third employee cell (Donna) merges across products to its left and across sales to its right.

Aa190827.deflexgridmergecellspropertyexamplefreemerging(en-us,office.10).gif
Restricted Merging
MergeCells =2
MergeRow(0) =True
MergeRow(1) =True
MergeRow(2) =True
MergeRow(3) =False

Notice how the third employee cell (Donna) no longer merges across sales.

Aa190827.deflexgridmergecellspropertyexamplerestrictedmerging(en-us,office.10).gif

See Also

MergeCol, MergeRow Properties (ModHFGrid) | ModHFGrid Control