C++ (Qt)
for (int i=startRow, rowCount = table->rowCount(); i < rowCount; ++i){
for (int j=StartColumn, columnCount = table->columnCount(); j < columnCount; ++j){
QAxObject *cell = worksheet->querySubObject("Cells(QVariant,QVariant)", i + 1, j + 1);
if( !cell ) {
QMessageBox::information(0, "Error"," worksheet->querySubObject");
return;
}
const QVariant data = table->item(i, j)->text();
cell->setProperty("Value", data);
}
}
The returned QAxObject is a child of this object (which is either of type QAxObject or QAxWidget), and is deleted when this object is deleted.