qt - QAxObject -- not creating excel in right format -
i working qaxobject
, able open existing file & read different sheets & cells.
but when creating new excel file using qaxobject
. creating test_1.xls
file. when open file gives me error. 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 try open file :-----
the file trying open diffrent format xls. verify file corrupted or not want open file or not
please suggest missing create .xls
file in correct format ?
ok,i solved problem. because install office2007, "save" function save file in 2007 format, save "*.xls", format can not recognized correctly.
so solution is, use "saveas" save excel 2003 format.
how set excel column format though qt?
qlist<qvariant> lstparam; lstparam.append("d:\\temp\\test_1.xls"); lstparam.append(-4143); lstparam.append(""); lstparam.append(""); lstparam.append(false); lstparam.append(false); lstparam.append(1); lstparam.append(2); lstparam.append(false); lstparam.append(false); lstparam.append(false); lstparam.append(false); workbook_1->dynamiccall("saveas(qvariant, qvariant, qvariant, qvariant, qvariant, qvariant, qvariant, qvariant, qvariant, qvariant, qvariant, qvariant)", lstparam);
Comments
Post a Comment