zoukankan      html  css  js  c++  java
  • 基于Qt 5.9.8,编译Qtxlsx

    1、源码下载地址:https://github.com/dbzhang800/QtXlsxWriter

    2、下载并安装编译时需要的工具 Perl:https://www.perl.org/get.html,根据不同的系统选择不同的perl,对于我们来讲选择activeperl安装包即可。

    3、解压QtXlsxWriter-master.zip到E盘根目录下,用Qt 5.9.8 Creator打开E:/QtXlsxWriter-master/src/src.pro。

    4、打开xlsxzipreader.cpp文件,定位到51行,把QList 改成 QVector 

      QVector<QZipReader::FileInfo> allFiles = m_reader->fileInfoList();

      保存并构建项目src,这时在E:/QtXlsxWriter-master/lib目录下生成lib文件,在E:/QtXlsxWriter-master/bin目录下生成dll文件,E:/QtXlsxWriter-master/include目录下是一些头文件。

    5、拷贝E:/QtXlsxWriter-master/include/QtXlsx目录到Qt的include目录下:C:/Qt/Qt5.9.8/5.9.8/mingw53_32/include(ubuntu18.04的目录为/opt/Qt5.9.8/5.9.8/gcc_64/include)

    6、拷贝E:/QtXlsxWriter-master/lib文件夹下Qt5Xlsxd.lib(Qt5Xlsxd.a) Qt5Xlsx.lib(Qt5Xlsx.a) Qt5Xlsx.prl Qt5Xlsxd.prl4个文件到Qt的lib下:C:/Qt/Qt5.9.8/5.9.8/mingw53_32/lib(ubuntu18.04的目录为/opt/Qt5.9.8/5.9.8/gcc_64/lib)

    7、拷贝E:/QtXlsxWriter-master/bin文件夹下的Qt5Xlsx.dll Qt5Xlsxd.dll库文件的Qt库路径下C:/Qt/Qt5.9.8/5.9.8/mingw53_32/bin(ubuntu18.04无)

    8、拷贝 E:/QtXlsxWriter-master/mkspecs/modules-inst 文件夹下的qt_lib_xlsx.pri和qt_lib_xlsx_private.pri到Qt模块下 C:/Qt/Qt5.9.8/5.9.8/mingw53_32/mkspecs/modules(ubuntu18.04的目录为/opt/Qt5.9.8/5.9.8/gcc_64/mkspecs/modules)

    9、拷贝E:/QtXlsxWriter-master/src文件夹到C:/Qt/Qt5.9.8/5.9.8/mingw53_32目录下(ubuntu18.04的目录为/opt/Qt5.9.8/5.9.8/Src)

    10、接下来就可以使用Qt进行excel的操作了,只是需要注意:

      使用的时候需要包含头文件

      #include <QtXlsx>

      using namespace QXlsx;

      在你的qmake .pro 需要添加
      QT += xlsx


  • 相关阅读:
    printf输出函数
    死循环的3种编写方案
    volatile 和const 变量的使用
    arm mov 指令
    arm ldr 指令
    arm str 指令
    Ztree-
    端口占用问题:java.net.BindException: Address already in use: bind
    模块和包
    序列化模块:json、pickle、shelve
  • 原文地址:https://www.cnblogs.com/zhangnianyong/p/11447038.html
Copyright © 2011-2022 走看看