Skip to content

Latest commit

 

History

History
137 lines (81 loc) · 2.8 KB

HowToSetProject.md

File metadata and controls

137 lines (81 loc) · 2.8 KB

How to setup QXlsx project

Read this in other languages: English, 🇰🇷 한국어

  • Here's an easy way to apply QXlsx.
  • This works only with qmake, for cmake look at the other doc.
  • Describes when to apply to Windows.
  • The method of applying it on Linux or Mac is similar, and I will write help if there is an additional request.
    • Hi! I'm j2doll. My native language is not English and my English is not fluent. Please understand. :-)

Steps to set

1️⃣ Clone source code from github

git clone https://github.com/j2doll/QXlsx.git



2️⃣ Execute QtCreator



3️⃣ Create your own Qt Project.



4️⃣ Sample is console application.



5️⃣ Set project name. Current project name is HelloQXlsx.



6️⃣ HelloQXlsx project has been created.



7️⃣ Current directory for project



8️⃣ Copy QXlsx code to your app project

xcopy c:\workspace\github\QXlsx\QXlsx c:\workspace\HelloQXlsx /s /e



9️⃣ Current directories and files for project



🔟 Append code for QXlxs library on your Qt project(*.pro)

# QXlsx code for Application Qt project
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)



1️⃣1️⃣ Set header files and namespace for sample. Then append hello world code.

// main.cpp

#include <QCoreApplication>

#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("Test.xlsx"); // save the document as 'Test.xlsx'

    return 0;
    // return a.exec();
}



1️⃣2️⃣ Build and Run a project



1️⃣3️⃣ A execute file(*.exe) and a excel file(xlsx) is created.