From df16aa097e2fcadb00700ebc95d57389cddf26ee Mon Sep 17 00:00:00 2001
From: wumu <mayibase@mayi.com>
Date: 星期五, 01 三月 2024 03:07:31 +0800
Subject: [PATCH] 0301-1

---
 internal_system_v1/coverinfo.cpp |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/internal_system_v1/coverinfo.cpp b/internal_system_v1/coverinfo.cpp
index a749448..881d37c 100644
--- a/internal_system_v1/coverinfo.cpp
+++ b/internal_system_v1/coverinfo.cpp
@@ -5,6 +5,7 @@
 #include <QFileDialog>
 #include <QSqlQuery>
 #include <QSqlRecord>
+#include "windows.h"
 
 int g_comId = 0; // 鍏ㄥ眬鍙橀噺锛屼繚瀛樺崟浣峣d
 QString g_dataRootPath; // 鏁版嵁鐨勬牴鐩綍
@@ -14,6 +15,8 @@
     ui(new Ui::CoverInfo)
 {
     ui->setupUi(this);
+    CoInitializeEx(NULL, COINIT_MULTITHREADED); // 鍏堝皢COM搴撳垵濮嬪寲
+
     readInfo();
     readDataFromSQL(); // 浠庢暟鎹簱璇诲彇鏁版嵁
 
@@ -58,6 +61,9 @@
         qDebug()<<"index:"<<index;
         if(index > 0){
             QAxObject excel("Excel.Application");
+            if(!excel.setControl("Excel.Application")){
+                excel.setControl("ket.Application"); // wps鍐呮牳
+            }
             excel.setProperty("Visible",false);
             excel.setProperty("DisplayAlerts",false);
             qDebug()<<"open:"<<str;

--
Gitblit v1.8.0