当前位置:网站首页>QT (35) - operate excel qxlsx qaxobject
QT (35) - operate excel qxlsx qaxobject
2022-06-25 00:59:00 【Cloudy summer】
Reading and writing EXCEL It's a routine operation .QT5 Previous versions use QAxObject operation EXCEL, The disadvantage is that the system must be equipped with OFFICE perhaps WPS.QT5 You can use it Qxlsx 了 , The advantage is that the system does not need to be installed OFFICE perhaps WPS.
Use Qxlsx There are two ways :
1. hold bin,lib,include Join the system environment
2. Directly into the project . I prefer to join the project directly . The second method is given in this paper .
1. Download library files
2. Create project
3. Copy the library file to the project
4. Modify the configuration .pro file + Add header reference
1. Download library files :
my demo Examples and library files , For download .
QT,EXCEL,QXLSX-C++ Document resources -CSDN download
2. Create project 

3. Copy the library file to the project 
4. Modify the configuration .pro file + Add header reference 
DEFINES += QT_DEPRECATED_WARNINGS
QXLSX_PARENTPATH=./ # current QXlsx path is . (. means curret directory)
QXLSX_HEADERPATH=./header/ # current QXlsx header path is ./header/
QXLSX_SOURCEPATH=./source/ # current QXlsx source path is ./source/
include(./QXlsx.pri) 
#include "xlsxdocument.h"
#include "xlsxchartsheet.h"
#include "xlsxcellrange.h"
#include "xlsxchart.h"
#include "xlsxrichstring.h"
#include "xlsxworkbook.h"
using namespace QXlsx;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QXlsx::Document xlsx;
xlsx.write("A1", "Hello Qt!"); // write "Hello Qt!" to cell(A,1). it's shared string.
xlsx.saveAs("helloqxlsx.xlsx"); // save the document as 'Test.xlsx'
return 0;
// return a.exec();
}
边栏推荐
- @mysql
- Can communication experiment between C and C
- Outer screen and widescreen wasted? Harmonyos folding screen design specification teaches you to use it
- Wallpaper applet wechat applet
- Xcode preview displays a bug in the content of the list view and its solution
- 移动安全工具-jar
- More pictures | explain the Nacos parameters in detail!
- Mobile security tool jarsigner
- 2022安全员-C证考试模拟100题及在线模拟考试
- A small program written this week
猜你喜欢

The acceleration of 100 km is only 5.92 seconds, and the willanda high-performance version leads with the strength of high-energy products

大厂高频软件测试面试题和答案都帮你准备好啦,备战金九银十

Custom control - round dot progress bar (imitating one key acceleration in security guard)

Apk slimming compression experience

Activity startup process

2022年全国最新消防设施操作员(高级消防设施操作员)模拟题及答案

Network request -volley

打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?
Difficult and miscellaneous problems: A Study on the phenomenon of text fuzziness caused by transform

Single blind box removal, social blind box and friend blind box program source code
随机推荐
JSON file of China's provincial boundaries
Applet opening traffic master
D does not require opapply() as a domain
2022安全员-C证考试模拟100题及在线模拟考试
Microsoft won the title of "leader" in the magic quadrant of Gartner industrial Internet of things platform again!
Mobile security tool -dex2jar
JMeter socket connection sends data
Usage of ViewModel and livedata in jetpack
How to use promise Race() and promise any() ?
D omit parameter name
【微服务|Sentinel】Sentinel快速入门|构建镜像|启动控制台
ros(25):rqt_image_view报错Unable to load plugin for transport ‘compressed‘, error string
Registration method of native method in JNI
Infotnews | is the development of domestic NFT limited to digital collections?
Source code analysis the problem that fragments cannot be displayed in the custom ViewGroup
[redis realizes seckill service ④] one order for one person, and cannot be purchased repeatedly
无需显示屏的VNC Viewer远程连接树莓派
2022年危险化学品经营单位安全管理人员考试试题及模拟考试
[microservices sentinel] sentinel quick start | building an image | starting the console
腾讯云国际云服务器网络访问丢包问题解决办法