1、我们接着上文创建excel的文章接着处理,打开相应的项目。

3、同时,前文newExcel设置为读取excel,如果没有则新建,可以获取excel的活动句柄。然后方便我们后续操作。

5、在cpp文件中我们实现函数的功能。输入以下代码: int intCount = pSheets->property("Count").toInt();//获取工资表数量 QAxObject *pLastSheet = pSheets->querySubObject("Item(int)",intCount); pSheets->querySubObject("Add(QVariant)",pLastSheet->asVariant()); pSheet = pSheets->querySubObject("Item(int)",intCount); pLastSheet->dynamicCall("Move(QVariant)",pSheet->asVariant()); pSheet->setProperty("Name",sheetName);

7、我们再次运行一下程序。可以看到效果如下。
