#include "exporttofile.h" #include #include #include #include #include #include #pragma execution_character_set("utf-8") ExportToFile::ExportToFile(QObject *parent) : QObject(parent) { } int ExportToFile::saveToExcelFromComInfo(ComInfo &info) { // 读取当前目录下的模板文件,然后往里写数据,修改保存 // QString savePath = QFileDialog::getExistingDirectory(nullptr,"选择文件夹",QDir::currentPath()); // qDebug()<<"savepath:"< 0){ QAxObject excel("ket.Application"); if(!excel.setControl("ket" ".Application")){ // windows内核 excel.setControl("Excel.Application"); // wps内核 } excel.setProperty("Visible",false); excel.setProperty("DisplayAlerts",false); QAxObject * wbs = excel.querySubObject("WorkBooks"); qDebug()<<"wbs:"<className(); QAxObject * wb = wbs->querySubObject("Open(QString&)",demoPath); qDebug()<<"wb open ok"; QAxObject * shs = wb->querySubObject("WorkSheets"); // WorkSheets 也可以 // 获取具体表格,行列 QAxObject * sheet = shs->querySubObject("Item(int)", 1); // 第一个表 QAxObject *usedRange = sheet->querySubObject("UsedRange"); int rows = usedRange->querySubObject("Rows")->property("Count").toInt(); int columns = usedRange->querySubObject("Columns")->property("Count").toInt(); qDebug()<<"r--c:"<querySubObject("Cells(int,int)", 1, 10)->dynamicCall("SetValue(const QString&)","1000200300"); // QAxObject *cell1 = sheet->querySubObject("Range(QVariant, QVariant)", "D10"); // qDebug()<<"B3原数据:"<dynamicCall("Value2()").toString(); // /* ---- 修改单个单元格中的数据 ---- */ // cell1->setProperty("Value2", "21321321312"); // qDebug()<<"B3修改后的数据:"<dynamicCall("Value2()").toString(); // QAxObject *cell2 = sheet->querySubObject("Range(QVariant, QVariant)", "G63"); // qDebug()<<"B3原数据:"<dynamicCall("Value2()").toString(); // /* ---- 修改单个单元格中的数据 ---- */ // cell2->setProperty("Value2", "10"); // qDebug()<<"G63修改后的数据:"<dynamicCall("Value2()").toString(); // QAxObject *cell3 = sheet->querySubObject("Range(QVariant, QVariant)", "E57"); // qDebug()<<"B3原数据:"<dynamicCall("Value2()").toString(); // /* ---- 修改单个单元格中的数据 ---- */ // cell3->setProperty("Value2", "4 其他"); // qDebug()<<"E57修改后的数据:"<dynamicCall("Value2()").toString(); // 依次赋值 // 基本情况 sheet->querySubObject("Range(QVariant, QVariant)", "D10")->setProperty("Value2", info.creditCode); // 统一信用代码 qDebug()<<1; sheet->querySubObject("Range(QVariant, QVariant)", "I10")->setProperty("Value2", QString::fromLocal8Bit(info.name)); // 单位名称 qDebug()<<2; sheet->querySubObject("Range(QVariant, QVariant)", "D13")->setProperty("Value2", QString::fromLocal8Bit(info.comType)); // 机构类型 qDebug()<<3; sheet->querySubObject("Range(QVariant, QVariant)", "C19")->setProperty("Value2", QString::fromLocal8Bit(info.business)); // 业务活动 qDebug()<<4; sheet->querySubObject("Range(QVariant, QVariant)", "E20")->setProperty("Value2", info.businessCode); // 行业代码 qDebug()<<5; sheet->querySubObject("Range(QVariant, QVariant)", "B22")->setProperty("Value2", QString::fromLocal8Bit(info.addr)); // 注册地及区划 qDebug()<<6; sheet->querySubObject("Range(QVariant, QVariant)", "C25")->setProperty("Value2", info.areaCode); // 区域代码 qDebug()<<7; sheet->querySubObject("Range(QVariant, QVariant)", "G25")->setProperty("Value2", info.townCode); // 城乡代码 qDebug()<<8; sheet->querySubObject("Range(QVariant, QVariant)", "C26")->setProperty("Value2", QString::fromLocal8Bit(info.scale)); // 单位规模 qDebug()<<9; sheet->querySubObject("Range(QVariant, QVariant)", "G27")->setProperty("Value2", info.people); // 从业人员数量 qDebug()<<10; sheet->querySubObject("Range(QVariant, QVariant)", "E28")->setProperty("Value2", QString::fromLocal8Bit(info.representative)); // 法人 qDebug()<<11; sheet->querySubObject("Range(QVariant, QVariant)", "I28")->setProperty("Value2", QString::fromLocal8Bit(info.standardType)); // 执行会计标准 qDebug()<<12; sheet->querySubObject("Range(QVariant, QVariant)", "C32")->setProperty("Value2", info.trunkCode); // 长途区号 qDebug()<<13; sheet->querySubObject("Range(QVariant, QVariant)", "C33")->setProperty("Value2", info.fixedTel); // 固定电话 qDebug()<<14; sheet->querySubObject("Range(QVariant, QVariant)", "C34")->setProperty("Value2", info.postCode); // 邮政编码 qDebug()<<15; sheet->querySubObject("Range(QVariant, QVariant)", "F31")->setProperty("Value2", info.email); // 电子邮箱 qDebug()<<16; sheet->querySubObject("Range(QVariant, QVariant)", "F33")->setProperty("Value2", info.webSite); // 网址 qDebug()<<17; // 二 单位组织结构情况 sheet->querySubObject("Range(QVariant, QVariant)", "E36")->setProperty("Value2", QString::fromLocal8Bit(info.hasUpLegal)); // 是否有上一级法人 qDebug()<<18; sheet->querySubObject("Range(QVariant, QVariant)", "H37")->setProperty("Value2", QString::fromLocal8Bit(info.upCreditCode)); // 上一级统一社会信用代码 qDebug()<<19; sheet->querySubObject("Range(QVariant, QVariant)", "H38")->setProperty("Value2", QString::fromLocal8Bit(info.oldCreditCode)); // 原组织机构代码 qDebug()<<20; sheet->querySubObject("Range(QVariant, QVariant)", "H39")->setProperty("Value2", QString::fromLocal8Bit(info.upName)); // 上一级单位名称 qDebug()<<21; // 三 总审计师与内部审计机构基本情况 sheet->querySubObject("Range(QVariant, QVariant)", "E41")->setProperty("Value2", QString::fromLocal8Bit(info.hasChiefDesigner)); // 是否设置总审计师 qDebug()<<22; sheet->querySubObject("Range(QVariant, QVariant)", "E42")->setProperty("Value2", QString::fromLocal8Bit(info.ChiefDesignerLevel)); // 总审计师职位层级 qDebug()<<23; sheet->querySubObject("Range(QVariant, QVariant)", "E45")->setProperty("Value2", QString::fromLocal8Bit(info.employmentMode)); // 总审任职方式 qDebug()<<24; sheet->querySubObject("Range(QVariant, QVariant)", "E48")->setProperty("Value2", QString::fromLocal8Bit(info.hasSetIntervalAudit)); // 是否设置内审机构 qDebug()<<25; sheet->querySubObject("Range(QVariant, QVariant)", "E49")->setProperty("Value2", QString::fromLocal8Bit(info.internalName)); // 内审机构名称 qDebug()<<26; sheet->querySubObject("Range(QVariant, QVariant)", "E50")->setProperty("Value2", QString::fromLocal8Bit(info.leadingOrganization)); // 领导机构 qDebug()<<27; sheet->querySubObject("Range(QVariant, QVariant)", "E54")->setProperty("Value2", QString::fromLocal8Bit(info.hasSetSeparateIA)); // 是否独立设置内审机构 qDebug()<<28; sheet->querySubObject("Range(QVariant, QVariant)", "E56")->setProperty("Value2", info.financeDepartment); // 财务部门 qDebug()<<29; sheet->querySubObject("Range(QVariant, QVariant)", "E56")->setProperty("Value2", info.legalDepartment); // 法务部门 qDebug()<<30; sheet->querySubObject("Range(QVariant, QVariant)", "E56")->setProperty("Value2", info.internalConDepart); // 内部控制部门 qDebug()<<31; sheet->querySubObject("Range(QVariant, QVariant)", "E56")->setProperty("Value2", info.disceplineInDepart); // 纪检部门 qDebug()<<32; sheet->querySubObject("Range(QVariant, QVariant)", "E56")->setProperty("Value2", info.otherDepart); // 其他部门 qDebug()<<33; sheet->querySubObject("Range(QVariant, QVariant)", "E57")->setProperty("Value2", QString::fromLocal8Bit(info.intavalAuditLeval)); // 内审层级 qDebug()<<34; // 四 内部审计人员配备基本情况 sheet->querySubObject("Range(QVariant, QVariant)", "E61")->setProperty("Value2", info.organazationNum); // 编制数量 qDebug()<<35; sheet->querySubObject("Range(QVariant, QVariant)", "G61")->setProperty("Value2", info.realNum); // 实有人员数 qDebug()<<36; sheet->querySubObject("Range(QVariant, QVariant)", "I61")->setProperty("Value2", info.professionalNum); // 专职人员数量 qDebug()<<37; sheet->querySubObject("Range(QVariant, QVariant)", "G62")->setProperty("Value2", info.CIANum); // 拥有CIA人数 qDebug()<<38; sheet->querySubObject("Range(QVariant, QVariant)", "G63")->setProperty("Value2", info.masterNum); // 硕士学历以上人数 qDebug()<<39; sheet->querySubObject("Range(QVariant, QVariant)", "G64")->setProperty("Value2", info.undergraduatesNum); // 本科人数 qDebug()<<40; sheet->querySubObject("Range(QVariant, QVariant)", "G65")->setProperty("Value2", info.juniorNum); // 专科及以下人数 qDebug()<<41; sheet->querySubObject("Range(QVariant, QVariant)", "G66")->setProperty("Value2", info.seniorNum); // 高级职称人数 qDebug()<<42; sheet->querySubObject("Range(QVariant, QVariant)", "G67")->setProperty("Value2", info.intermediateNum); // 中级职称人数 qDebug()<<43; sheet->querySubObject("Range(QVariant, QVariant)", "G68")->setProperty("Value2", info.primaryNum); // 初级职称人数 qDebug()<<44; sheet->querySubObject("Range(QVariant, QVariant)", "G69")->setProperty("Value2", info.noTitleNum); // 无职称人数 qDebug()<<45; sheet->querySubObject("Range(QVariant, QVariant)", "G70")->setProperty("Value2", info.upFiftyOldNum); // 50岁以上人数 qDebug()<<46; sheet->querySubObject("Range(QVariant, QVariant)", "G71")->setProperty("Value2", info.upThirtyOldNum); // 30-50岁人数 qDebug()<<47; sheet->querySubObject("Range(QVariant, QVariant)", "G72")->setProperty("Value2", info.downThirtyOldNum); // 30岁以下人数 qDebug()<<48; sheet->querySubObject("Range(QVariant, QVariant)", "G73")->setProperty("Value2", info.auditNum); // 审计数量 qDebug()<<49; sheet->querySubObject("Range(QVariant, QVariant)", "G74")->setProperty("Value2", info.accountingNum); // 会计数量 qDebug()<<50; sheet->querySubObject("Range(QVariant, QVariant)", "G75")->setProperty("Value2", info.economyNum); // 经济数量 qDebug()<<51; sheet->querySubObject("Range(QVariant, QVariant)", "G76")->setProperty("Value2", info.lawNum); // 法律数量 qDebug()<<52; sheet->querySubObject("Range(QVariant, QVariant)", "G77")->setProperty("Value2", info.managerNum); // 管理数量 qDebug()<<53; sheet->querySubObject("Range(QVariant, QVariant)", "G78")->setProperty("Value2", info.itNum); // 信息技术数量 qDebug()<<54; sheet->querySubObject("Range(QVariant, QVariant)", "G79")->setProperty("Value2", info.engineeringNum); // 工程数量 qDebug()<<55; sheet->querySubObject("Range(QVariant, QVariant)", "G80")->setProperty("Value2", info.otherNum); // 其他数量 qDebug()<<56; // 后面的4个信息 sheet->querySubObject("Range(QVariant, QVariant)", "B82")->setProperty("Value2", QString::fromLocal8Bit(info.statisticalConOfficer)); // 统计负责人 qDebug()<<57; sheet->querySubObject("Range(QVariant, QVariant)", "E82")->setProperty("Value2", QString::fromLocal8Bit(info.personFilling)); // 填表人 qDebug()<<58; sheet->querySubObject("Range(QVariant, QVariant)", "B83")->setProperty("Value2", QString::fromLocal8Bit(info.officerTel)); // 联系电话 qDebug()<<59; sheet->querySubObject("Range(QVariant, QVariant)", "E83")->setProperty("Value2", QString::fromLocal8Bit(info.fillingDateTime)); // 填报日期 qDebug()<<60; // 完事了,结束,保存或者退出 wb->dynamicCall("SaveAs(const QString&)",QDir::toNativeSeparators(savePath)); wbs->dynamicCall("Close()"); excel.dynamicCall("Quit(void)"); QMessageBox::information(nullptr,"导出完成","文件位置:"+savePath); } return 0; } int ExportToFile::saveToExcelFromThreeMergePro() { return 0; } int ExportToFile::saveToExcelFromNeiShenZonghe(QString name,NeiShenZongHeInfo &nszh) { qDebug()<<"内审综合保存导出"; if(name.size() == 0) { QMessageBox::information(nullptr,"公司名为空","请选择一个公司再导出保存"); return -1; // 文件为空 } QString demoPath = QDir::currentPath()+"/Data/附件4_内审统03表_内部审计统计综合表.xls"; QDir dir(demoPath); if(!dir.exists()){ demoPath = QDir::currentPath()+"/release/Data/附件4_内审统03表_内部审计统计综合表.xls"; } QString dt = QDateTime::currentDateTime().toString("yyyyMMdd-HHmmss"); QString savePath = QFileDialog::getSaveFileName(nullptr,"保存文件",QDir::currentPath()+QString("/综合表_%1_%2.xls").arg(name).arg(dt),"Excel File(*.xls;*.xlsx)"); qDebug()<<"savepath:"< 0){ QAxObject excel("ket.Application"); if(!excel.setControl("ket" ".Application")){ // windows内核 excel.setControl("Excel.Application"); // wps内核 } excel.setProperty("Visible",false); excel.setProperty("DisplayAlerts",false); QAxObject * wbs = excel.querySubObject("WorkBooks"); qDebug()<<"wbs:"<className(); QAxObject * wb = wbs->querySubObject("Open(QString&)",demoPath); qDebug()<<"wb open ok"; QAxObject * shs = wb->querySubObject("WorkSheets"); // WorkSheets 也可以 // 获取具体表格,行列 QAxObject * sheet = shs->querySubObject("Item(int)", 1); // 第一个表 QAxObject *usedRange = sheet->querySubObject("UsedRange"); int rows = usedRange->querySubObject("Rows")->property("Count").toInt(); int columns = usedRange->querySubObject("Columns")->property("Count").toInt(); qDebug()<<"r--c:"<querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(39))->setProperty("Value2", nszh.code_030300[i]); // 审计项目 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(40))->setProperty("Value2", nszh.code_030301[i]); // 其中:贯彻落实国家重大政策措施审计 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(41))->setProperty("Value2", nszh.code_030302[i]); // 财政财务收支审计 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(42))->setProperty("Value2", nszh.code_030303[i]); // 固定资产投资审计 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(43))->setProperty("Value2", nszh.code_030304[i]); // 内部控制和风险管理审计 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(44))->setProperty("Value2", nszh.code_030305[i]); // 经济责任审计 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(45))->setProperty("Value2", nszh.code_030306[i]); // 信息系统审计 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(46))->setProperty("Value2", nszh.code_030307[i]); // 境外审计 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(47))->setProperty("Value2", nszh.code_030308[i]); // 其他 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(48))->setProperty("Value2", nszh.code_030310[i]); // 其中:委托外包项目 } qDebug()<<39; // 五 本填报周期内部审计工作量 隐藏 // 六、审计发现问题金额 单位 元 for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(50))->setProperty("Value2", nszh.code_030500[i]); // 审计发现问题金额 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(51))->setProperty("Value2", nszh.code_030510[i]); // 其中:绩效类问题金额 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(52))->setProperty("Value2", nszh.code_030520[i]); // 合规性问题金额 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(53))->setProperty("Value2", nszh.code_030521[i]); // 其中:会计核算方面 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(54))->setProperty("Value2", nszh.code_030522[i]); // 违规使用资金 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(55))->setProperty("Value2", nszh.code_030523[i]); // 截留、沉淀资金 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(56))->setProperty("Value2", nszh.code_030524[i]); // 损失浪费 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(57))->setProperty("Value2", nszh.code_030525[i]); // 挪用资金 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(58))->setProperty("Value2", nszh.code_030526[i]); // 偷漏税费 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(59))->setProperty("Value2", nszh.code_030527[i]); // 违规取得收入 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(60))->setProperty("Value2", nszh.code_030528[i]); // 其他 } // 七、审计发现问题个数 for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(61))->setProperty("Value2", nszh.code_030600[i]); // 审计发现问题个数 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(62))->setProperty("Value2", nszh.code_030610[i]); // 其中:金额类问题个数 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(63))->setProperty("Value2", nszh.code_030620[i]); // 非金额类问题个数 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(64))->setProperty("Value2", nszh.code_030621[i]); // 其中:国家政策措施落实方面 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(65))->setProperty("Value2", nszh.code_030622[i]); // 发展规划与战略决策方面 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(66))->setProperty("Value2", nszh.code_030623[i]); // 内部控制与风险管理方面 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(67))->setProperty("Value2", nszh.code_030624[i]); // 其他 } // 八、审计发现问题整改(金额类) 单位 元 for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(68))->setProperty("Value2", nszh.code_030700[i]); // 审计发现问题整改(金额类) } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(69))->setProperty("Value2", nszh.code_030701[i]); // 其中:调整会计账目 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(70))->setProperty("Value2", nszh.code_030702[i]); // 收回资金 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(71))->setProperty("Value2", nszh.code_030703[i]); // 挽回损失 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(72))->setProperty("Value2", nszh.code_030704[i]); // 归还原资金渠道 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(73))->setProperty("Value2", nszh.code_030705[i]); // 补缴税费 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(74))->setProperty("Value2", nszh.code_030706[i]); // 其他 } // 九、审计发现问题整改(非金额类) 单位 个 for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(75))->setProperty("Value2", nszh.code_030800[i]); // 审计发现问题整改(非金额类) } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(76))->setProperty("Value2", nszh.code_030801[i]); // 其中:新制定制度 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(77))->setProperty("Value2", nszh.code_030802[i]); // 修订完善制度 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(78))->setProperty("Value2", nszh.code_030803[i]); // 优化完善业务流程 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(79))->setProperty("Value2", nszh.code_030804[i]); // 其他 } // 十、根据审计建议给予党纪、政务和内部纪律处分 单位 人 for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(80))->setProperty("Value2", nszh.code_030900[i]); // 根据审计建议给予党纪、政务和内部纪律处分 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(81))->setProperty("Value2", nszh.code_030901[i]); // 其中:党纪处分 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(82))->setProperty("Value2", nszh.code_030902[i]); // 政务处分 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(83))->setProperty("Value2", nszh.code_030903[i]); // 内部纪律处分 } // 十一、向司法机关移送或报告案件线索 for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(84))->setProperty("Value2", nszh.code_031000[i]); // 向司法机关移送或报告案件线索 } for(int i=0;i<5;++i){ sheet->querySubObject("Range(QVariant, QVariant)", QString("%1%2").arg(index[i]).arg(85))->setProperty("Value2", nszh.code_031001[i]); // 其中:涉案人员 } // 完事了,结束,保存或者退出 wb->dynamicCall("SaveAs(const QString&)",QDir::toNativeSeparators(savePath)); wbs->dynamicCall("Close()"); excel.dynamicCall("Quit(void)"); QMessageBox::information(nullptr,"导出完成","文件位置:"+savePath); } return 0; }