ui->excel->setControl(srcfile);
//QAxObject * workbooks = ui->excel->querySubObject("WorkBooks");
//workbooks->dynamicCall("Open (const QString&)", srcfile);
//QAxObject * workbook = workbooks->querySubObject("ActiveWorkBook");
QAxObject * worksheet
= ui
->excel
->querySubObject
("Worksheets(1)");
QAxObject * piva,
* tipo,
* data,
* num,
* scad,
* tot;
//ui->excel->setProperty("Visible", false);
int i=0;
while (qry->next()){
piva = worksheet->querySubObject("Cells(int,int)", i+2,1);
tipo = worksheet->querySubObject("Cells(int,int)", i+2,3);
data = worksheet->querySubObject("Cells(int,int)", i+2,4);
num = worksheet->querySubObject("Cells(int,int)", i+2,5);
scad = worksheet->querySubObject("Cells(int,int)", i+2,6);
tot = worksheet->querySubObject("Cells(int,int)", i+2,7);
piva->setProperty("Value",qry->value(0).toString().mid(2,-1).trimmed());
if (qry->value(2).toString().startsWith('N'))
tipo->setProperty("Value","N");
dtData
=QDate::fromString(qry
->value
(1).
toString(),
"yyyyMMdd");
dtScad
=QDate::fromString(qry
->value
(4).
toString(),
"yyyyMMdd");
data->setProperty("Value",dtData.toString("dd/MM/yy"));
//num->setProperty("Value",QString("%1 %2").arg(qry->value(2).toString()).arg(qry->value(3).toString()));
num->setProperty("Value",qry->value(3).toString());
scad->setProperty("Value",dtScad.toString("dd/MM/yy"));
tot->setProperty("Value",qry->value(5).toDouble());
i++;
}
ui->excel->setProperty("DisplayAlerts", false);
ui->excel->dynamicCall("Run(QVariant)", "ckCampi");
ui->excel->setControl(srcfile);
//QAxObject * workbooks = ui->excel->querySubObject("WorkBooks");
//workbooks->dynamicCall("Open (const QString&)", srcfile);
//QAxObject * workbook = workbooks->querySubObject("ActiveWorkBook");
QAxObject * worksheet = ui->excel->querySubObject("Worksheets(1)");
QAxObject * piva, * tipo, * data, * num, * scad, * tot;
//ui->excel->setProperty("Visible", false);
int i=0;
while (qry->next()){
piva = worksheet->querySubObject("Cells(int,int)", i+2,1);
tipo = worksheet->querySubObject("Cells(int,int)", i+2,3);
data = worksheet->querySubObject("Cells(int,int)", i+2,4);
num = worksheet->querySubObject("Cells(int,int)", i+2,5);
scad = worksheet->querySubObject("Cells(int,int)", i+2,6);
tot = worksheet->querySubObject("Cells(int,int)", i+2,7);
piva->setProperty("Value",qry->value(0).toString().mid(2,-1).trimmed());
if (qry->value(2).toString().startsWith('N'))
tipo->setProperty("Value","N");
QDate dtData,dtScad;
dtData=QDate::fromString(qry->value(1).toString(),"yyyyMMdd");
dtScad=QDate::fromString(qry->value(4).toString(),"yyyyMMdd");
data->setProperty("Value",dtData.toString("dd/MM/yy"));
//num->setProperty("Value",QString("%1 %2").arg(qry->value(2).toString()).arg(qry->value(3).toString()));
num->setProperty("Value",qry->value(3).toString());
scad->setProperty("Value",dtScad.toString("dd/MM/yy"));
tot->setProperty("Value",qry->value(5).toDouble());
i++;
}
ui->excel->setProperty("DisplayAlerts", false);
ui->excel->dynamicCall("Run(QVariant)", "ckCampi");
To copy to clipboard, switch view to plain text mode
Bookmarks