有关Qt QAxWidget读取word 的问题

一夜了 一夜了 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
QAxWidget *word = new QAxWidget("Word.Application");
//word->setControl("{00460182-9E5E-11d5-B7C8-B8269041DD57}");
word->setProperty("Visible",true);
QAxObject *documents = word->querySubObject("Documents");
//QAxObject *documents;
//documents->dynamicCall("Add");
//documents->setControl("MSCal.Calendar");
//documents->dynamicCall("Add(QString)",QString::fromLocal8Bit("D:/template.dot"));
//documents->dynamicCall("Add (void)");
//documents->dynamicCall("Open(const QString&)",QString("D:/template.doc"));
documents->dynamicCall("Open(const QString&)", QString("D:/template.doc"));
QAxObject *document = word->querySubObject("ActiveDocument");
document->dynamicCall("SaveAs (const QString&)",QString("D:/template.docx"));
document->dynamicCall("Close (boolean)",false);

运行的时候documents->dynamicCall("Open(const QString&)", QString("D:/template.doc"));这段代码总是出现内存问题。我看了一下好像是documents指针为空,不知道为什么??
...全文
评论 1
收藏 已收藏
分享
返回顶部
一夜了
一夜了 优质创作者: 人工智能技术领域 优质创作者: 人工智能技术领域
其它技术问题 3,880 成员 9,044 内容