Read and Compare cells in a excel file with C++ -
i have project read excel file c++, , compare columns see similar, not sure start. need little on getting started on right foot. sorry if asked before, did not see it.
you can use different frameworks such purposes. suggest check out qt: qt docs qaxobject then, can operate excel file in way, example:
qaxobject* excelapp = new qaxobject("excel.application"); excelapp->setproperty("visible", false); qaxobject* workbooks = excelapp->querysubobject("workbooks"); workbooks->dynamiccall("open (const qstring&)", qstring("path .xls file")); qaxobject* workbooks = excelapp->querysubobject("activeworkbook"); qaxobject* worksheets = workbooks->querysubobject("worksheets"); qaxobject* worksheet = workbooks->querysubobject("worksheets(int)", 1); qaxobject* usedrange = worksheet->querysubobject("usedrange"); qaxobject* rows = usedrange->querysubobject("rows"); qaxobject* columns = usedrange->querysubobject("columns"); int rowsstart = usedrange->property("row").toint(); int rows = rows->property("count").toint(); int columnsstart = usedrange->property("column").toint(); int cols = columns->property("count").toint(); qaxobject * cell; (int i(rowsstart); != rowsstart + rows; ++i) { (int j(columnsstart); j != columnsstart + cols; ++j) { cell = excelapp->querysubobject("cells(int, int)", i, j ); qvariant val = cell->dynamiccall("value"); // whatever want value here. } }
Comments
Post a Comment