简体   繁体   English

在我的Qt应用程序中打开并与Excel通信

[英]Open and communicate with Excel in my Qt Application

I'm actually creating an application in QtCreator (open source), and I need to open Excel and communicate by sending to Excel data to show. 我实际上是在QtCreator(开源)中创建一个应用程序,我需要打开Excel并通过发送到Excel数据来进行通信。 I try to #include <QAxWidget> , and to modify my .pro file with: 我尝试#include <QAxWidget> ,并修改我的.pro文件:

CONFIG+= axcontainer
Qt += activeqt

But it didn't work. 但它没有用。 I've got the error QAxWidget was not declared in this scope . 我有错误QAxWidget was not declared in this scope I read lots of things contradictory on the Internet, like you must paid licence or else. 我在互联网上阅读了许多矛盾的东西,比如你必须支付许可证。

Can you explain to me, if there's a way to solve my problem? 你能解释一下,如果有办法解决我的问题吗? Thanks. 谢谢。

You need the "Qt5-way" of using the module from your project file: 您需要使用项目文件中的模块的“Qt5方式”:

QT += axcontainer

Also, you need to include the necessary header of course: 此外,您还需要包含必要的标题:

#include <QAxWidget>

You can find the more thorough explanation here with examples . 您可以通过示例找到更全面的解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM