Merges two or more cells.


Set_Property(OLECtrlEntID, "OLE.CellMerge[col; row]", Array)


Array has the following structure:

<1>Columns to mergeIntegerThe number of columns to be merged with the cell (including the cell)1
<2>Rows to mergeIntegerThe number of rows to be merged with the cell (including the cell)1


colIndex to an existing column
rowIndex to an existing row


The CellMerge property merges a cell with other cells to the right or below. To successfully merge cells, you must understand a few concepts regarding cell merging. For any given set of merged cells, the top left most cell is referred to as the Master Cell and the other merged cells are Slave Cells. The Master Cell is the one whose attributes and data are visible, whereas the Slave Cells are effectively "hidden."

When merging cells, the indices of this property refer to the cell that is to become a Master Cell of a merged set. The value indicates the size of the merged cell in cell units. For example, to merge a cell with the cell next to it, you want to set the cell's CellMerge property to 2:@FM:1. This is the same as saying that the cell is now 2 cells wide and 1 cell tall.


* Merge cell (1, 1) with the cell next to it 
Set_Property(@Window:".OLE_EDITTABLE", "OLE.CellMerge[1; 1]", 2:@FM:1)

When reading the CellMerge property, you get different results from Slave Cells than from other cells. Non-Merged cells always return 1:@FM:1. Master Cells always return the full dimensions of the merged set in cell units. Slave Cells always return negative values indicating the distance from itself to the master cell. For instance, in a 2x2 merged cell, the bottom-right most cell, which is a Slave Cell, will return -1:@FM:-1, because the Master Cell is one cell to the left and one cell to the above the Slave Cell.

This property's indices refer to columns and rows, not fields and records. Fields differ from columns in that a field can stretch over multiple columns. Likewise, records may occupy multiple rows. Cell merging is a low-level operation and therefore needs low-level input.

See Also


  • No labels