method Items.MergeCells ([Cell1 as Variant], [Cell2 as Variant], [Options as Variant])
Merges a list of cells.

TypeDescription
Cell1 as Variant A long expression that indicates the handle of the cell being merged, or a safe array that holds a collection of handles for the cells being merged. Use the ItemCell property to retrieves the handle of the cell. The first cell (in the list, if exists) specifies the cell being displayed in the new larger cell. 
Cell2 as Variant A long expression that indicates the handle of the cell being merged, or a safe array that holds a collection of handles for the cells being merged. Use the ItemCell property to retrieves the handle of the cell. The first cell in the list specifies the cell being displayed in the new larger cell.
Options as Variant Reserved.
The MergeCells method combines two or more cells into one cell. The data in the first specified cell is displayed in the new larger cell. All the other cells' data is not lost. Use the CellMerge property to merge or unmerge a cell with another cell in the same item. Use the ItemDivider property to display a single cell in the entire item ( merging all cells in the item ). Use the UnmergeCells method to unmerge the merged cells. Use the CellValue property to specify the cell's caption. Use the ItemCell property to retrieves the handle of the cell. Use the BeginMethod and EndUpdate methods to maintain performance, when merging multiple cells in the same time. The MergeCells methods creates a list of cells from Cell1 and Cell2 parameters that need to be merged, and the first cell in the list specifies the displayed cell in the merged cell. Use the SplitCell property to split a cell. Use the SelectableItem property to specify the user can select an item.

The following VB sample adds three columns, a root item and two child items:

With G2antt1
    .BeginUpdate
        .MarkSearchColumn = False
        .DrawGridLines = exAllLines
        .LinesAtRoot = exLinesAtRoot
        With .Columns.Add("Column 1")
            .Def(exCellValueFormat) = exHTML
        End With
        .Columns.Add "Column 2"
        .Columns.Add "Column 3"
        With .Items
            Dim h As Long
            h = .AddItem("Root. This is the root item")
            .InsertItem h, , Array("Child 1", "SubItem 2", "SubItem 3")
            .InsertItem h, , Array("Child 2", "SubItem 2", "SubItem 3")
            .ExpandItem(h) = True
            .SelectItem(h) = True
        End With
    .EndUpdate
End With

and it looks like follows ( notice that the caption of the root item is truncated by the column that belongs to ):

If we are merging the first three cells in the root item we get:

You can merge the first three cells in the root item using any of the following methods:

The following VB sample merges the first three cells:

With G2antt1.Items
    .MergeCells .ItemCell(.FocusItem, 0), Array(.ItemCell(.FocusItem, 1), .ItemCell(.FocusItem, 2))
End With

The following C++ sample merges the first three cells:

#include "Items.h"
CItems items = m_g2antt.GetItems();
COleVariant vtFocusCell( items.GetItemCell(items.GetFocusItem(), COleVariant( (long)0 ) ) ), vtMissing; V_VT( &vtMissing ) = VT_ERROR;
items.MergeCells( vtFocusCell, COleVariant( items.GetItemCell(items.GetFocusItem(), COleVariant( (long)1 ) ) ), vtMissing );
items.MergeCells( vtFocusCell, COleVariant( items.GetItemCell(items.GetFocusItem(), COleVariant( (long)2 ) ) ), vtMissing );

The following VB.NET sample merges the first three cells:

With AxG2antt1.Items
    .MergeCells(.ItemCell(.FocusItem, 0), .ItemCell(.FocusItem, 1))
    .MergeCells(.ItemCell(.FocusItem, 0), .ItemCell(.FocusItem, 2))
End With

The following C# sample merges the first three cells:

EXG2ANTTLib.Items items = axG2antt1.Items;
items.MergeCells(items.get_ItemCell( items.FocusItem, 0 ), items.get_ItemCell( items.FocusItem, 1 ),"");
items.MergeCells(items.get_ItemCell(items.FocusItem, 0), items.get_ItemCell(items.FocusItem, 2),"");

The following VFP sample merges the first three cells:

with thisform.G2antt1.Items
	.MergeCells(.ItemCell(.FocusItem,0), .ItemCell(.FocusItem,1), "")
	.MergeCells(.ItemCell(.FocusItem,0), .ItemCell(.FocusItem,2), "")
endwith

Now, the question is what should I use in my program in order to merge some cells? For instance, if you are using handle to cells ( HCELL type ), we would recommend using the MergeCells method, else you could use as well the CellMerge property.