From a3f97ceb36d4cb60bacdfbcb04c364faaca6138a Mon Sep 17 00:00:00 2001 From: wumu <mayi@mayi.com> Date: 星期五, 29 十一月 2024 23:29:07 +0800 Subject: [PATCH] 1129 --- internal_system_v1/exporttofile.cpp | 422 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 420 insertions(+), 2 deletions(-) diff --git a/internal_system_v1/exporttofile.cpp b/internal_system_v1/exporttofile.cpp index 7e56b0f..89cc27a 100644 --- a/internal_system_v1/exporttofile.cpp +++ b/internal_system_v1/exporttofile.cpp @@ -1,5 +1,12 @@ 锘�#include "exporttofile.h" +#include <QFileDialog> +#include <QDebug> +#include <QAxObject> +#include <QFile> +#include <QDateTime> +#include <QMessageBox> +#pragma execution_character_set("utf-8") ExportToFile::ExportToFile(QObject *parent) : QObject(parent) { @@ -7,15 +14,426 @@ int ExportToFile::saveToExcelFromComInfo(ComInfo &info) { + // 璇诲彇褰撳墠鐩綍涓嬬殑妯℃澘鏂囦欢锛岀劧鍚庡線閲屽啓鏁版嵁锛屼慨鏀逛繚瀛� + +// QString savePath = QFileDialog::getExistingDirectory(nullptr,"閫夋嫨鏂囦欢澶�",QDir::currentPath()); +// qDebug()<<"savepath:"<<savePath; + + QString demoPath = QDir::currentPath()+"/Data/闄勪欢2_鍐呭缁�01琛╛鍗曚綅鍙婂唴閮ㄥ璁℃満鏋勫熀鏈儏鍐佃〃-1.301鐗坃demo.xls"; + QDir dir(demoPath); + if(!dir.exists()){ + demoPath = QDir::currentPath()+"/release/Data/闄勪欢2_鍐呭缁�01琛╛鍗曚綅鍙婂唴閮ㄥ璁℃満鏋勫熀鏈儏鍐佃〃-1.301鐗坃demo.xls"; + } + QString dt = QDateTime::currentDateTime().toString("yyyyMMdd-HHmmss"); + QString savePath = QFileDialog::getSaveFileName(nullptr,"淇濆瓨鏂囦欢",QDir::currentPath()+QString("/鍐呭缁�01琛╛%1_%2.xls").arg(QString::fromLocal8Bit(info.name)).arg(dt),"Excel File(*.xls;*.xlsx)"); + qDebug()<<"savepath:"<<savePath <<endl << "demoPath:"<<demoPath; + + + + if(savePath.size() > 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:"<<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:"<<rows<<columns; + + // 淇敼鏌愪釜鍊� + //sheet->querySubObject("Cells(int,int)", 1, 10)->dynamicCall("SetValue(const QString&)","1000200300"); +// QAxObject *cell1 = sheet->querySubObject("Range(QVariant, QVariant)", "D10"); +// qDebug()<<"B3鍘熸暟鎹細"<<cell1->dynamicCall("Value2()").toString(); +// /* ---- 淇敼鍗曚釜鍗曞厓鏍间腑鐨勬暟鎹� ---- */ +// cell1->setProperty("Value2", "21321321312"); +// qDebug()<<"B3淇敼鍚庣殑鏁版嵁锛�"<<cell1->dynamicCall("Value2()").toString(); + +// QAxObject *cell2 = sheet->querySubObject("Range(QVariant, QVariant)", "G63"); +// qDebug()<<"B3鍘熸暟鎹細"<<cell2->dynamicCall("Value2()").toString(); +// /* ---- 淇敼鍗曚釜鍗曞厓鏍间腑鐨勬暟鎹� ---- */ +// cell2->setProperty("Value2", "10"); +// qDebug()<<"G63淇敼鍚庣殑鏁版嵁锛�"<<cell2->dynamicCall("Value2()").toString(); + +// QAxObject *cell3 = sheet->querySubObject("Range(QVariant, QVariant)", "E57"); +// qDebug()<<"B3鍘熸暟鎹細"<<cell3->dynamicCall("Value2()").toString(); +// /* ---- 淇敼鍗曚釜鍗曞厓鏍间腑鐨勬暟鎹� ---- */ +// cell3->setProperty("Value2", "4 鍏朵粬"); +// qDebug()<<"E57淇敼鍚庣殑鏁版嵁锛�"<<cell3->dynamicCall("Value2()").toString(); + + // 渚濇璧嬪�� + // 鍩烘湰鎯呭喌 + sheet->querySubObject("Range(QVariant, QVariant)", "D10")->setProperty("Value2", info.creditCode); // 缁熶竴淇$敤浠g爜 + 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); // 琛屼笟浠g爜 + 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); // 鍖哄煙浠g爜 + qDebug()<<7; + sheet->querySubObject("Range(QVariant, QVariant)", "G25")->setProperty("Value2", info.townCode); // 鍩庝埂浠g爜 + 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)); // 涓婁竴绾х粺涓�绀句細淇$敤浠g爜 + 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() +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:"<<savePath << endl << "demoPath:"<<demoPath; + + + + if(savePath.size() > 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:"<<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:"<<rows<<columns; + + // 淇敼鍐呭 + + // 鍥� 椤圭洰瀹¤ 鍗曚綅 涓� + char index[5]={'F','G','H','I','J'}; + + for(int i=0;i<5;++i){ + sheet->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]); // 缁忔祹璐d换瀹¤ + } + 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; } -- Gitblit v1.8.0