I found the following solution while googling.
So I reproduce the method to share with others who may have similar problem. Cheers.
Code:
//Merge cells for a range of cells:
BOOL MyClass::MergeCells(long nColumnStart, long nRowStart, long nColumnEnd, long nRowEnd)
{
VARIANTARG vargSelection;
if(!GetCellRange(&vargSelection, nColumnStart, nRowStart, nColumnEnd, nRowEnd))
return FALSE;
ClearAllArgs();
AddArgumentBool(NULL, 0, TRUE);
if (!ExlInvoke(vargSelection.pdispVal, L"MergeCells", NULL, DISPATCH_PROPERTYPUT, 0))
return FALSE;
return TRUE;
}
For full coding, plz refer to:
http://www.codeguru.com/cpp/data/mfc...le.php/c11745/