I am working with QAxObject
and able to open existing file & read different sheets & cells.
But when i am creating a new excel file using QAxObject
. It is creating the test_1.xls
file.
But when i open this file it gives me error. I am using ms-excel-2007
.
Code :---
QAxWidget excel_1("Excel.Application");
excel_1.setProperty("Visible", false);
QAxObject * workbooks_1 = excel_1.querySubObject("WorkBooks");
workbooks_1->dynamicCall("Add");
QAxObject * workbook_1 = excel_1.querySubObject("ActiveWorkBook");
QAxObject * worksheets = workbook_1->querySubObject("WorkSheets");
excel_1.setProperty("DisplayAlerts", 0);
workbook_1->dynamicCall("SaveAs (const QString&)", QString("D:\\Temp\\test_1.xls"));
workbook_1->dynamicCall("Close (Boolean)", false);
excel_1.setProperty("DisplayAlerts", 1);
excel_1.dynamicCall("Quit (void)");
error message
when i try to open this file :-----
The file you are trying to open is diffrent format than xls.
Verify that file is corrupted or not do you want to open this file or not
Please suggest what i am missing to create .xls
file in correct format ?