word 表格合并单元格函数 Merge(QAxObject *)
void mergeCells(QAxObject *table, int nStartRow,int nStartCol,int nEndRow,int nEndCol){
QAxObject* startCell =table->querySubObject("Cell(int, int)",nStartRow,nStartCol);
QAxObject* endCell = table->querySubObject("Cell(int, int)",nEndRow,nEndCol);
if(!startCell || !endCell)
return;
startCell->dynamicCall("Merge(QAxObject *)", endCell->asVariant());
}
合并2600行第一列到2610行第一列
合并一条数据大概耗时120ms(几万条合并就太慢了)
mergeCells(table, 2600, 1, 2610, 1);