1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-01-30 05:02:52 +08:00
2018-05-30 20:38:09 +09:00
2018-04-19 16:16:49 +09:00
2018-04-19 16:53:27 +09:00
2018-04-23 10:05:08 +09:00
2018-04-23 10:05:08 +09:00
2018-05-26 12:24:43 +09:00
2018-04-23 09:57:45 +09:00
2018-04-19 16:17:18 +09:00
2018-05-30 20:38:09 +09:00
2018-05-30 20:38:09 +09:00

QXlsx

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

Excel(xlsx) reader/writer library

  • QXlsx is excel file(*.xlsx) reader/writer library.
    • Because QtXlsx is no longer supported(2014), I created a new project that is based on QtXlsx. (2017-)
    • Development language of QXlsx is C++. (with Qt 5.x)
    • You don't need to use static library or dynamic shared object using QXlsx.

License

Sample (Hello excel)

1 Writing excel file(*.xlsx)

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'

2 Reading excel file(*.xlsx)

Document xlsx("Test.xlsx"); // load excel file
if (!xlsx.isLoadPackage()) { // failed to load excel 		
	return;
}
int row = 1; int col = 2;
Cell* cell = xlsx.cellAt(row, col); // get cell pointer. (row is 1. column is 2.)
if ( cell == NULL )
	continue; // cell vaule is not set
QVariant var = cell->readValue(); // read cell value (number(double), QDateTime, QString ...)
qint32 styleNo = cell->styleNumber(); // read cell style number
if ( styleNo >= 0 )
	qDebug() << row << " " << var << " , style:" << styleNo;
else
	qDebug() << row << " " << var;

How to build

1 * Install Qt 5 from Qt Company (2017-) 2 * Clone github source code

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

3 * Build QXlsx project (it is main project.)

  cd QXlsx
  qmake QXlsx.pro
  make debug (you may use 'make release'.)

4 * Build TestExcel (TestExcel is test project of QXlsx. see test code.)

  cd TestExcel
  qmake TestExcel.pro
  make

5 * Run TestExcel

 ./TestExcel

📌 * Include QXlsx.pri and set QXlsx path value for your own qt project.

# default relative path (you may not set this value. then default value will be used.)
QXLSX_PARENTPATH=./
QXLSX_HEADERPATH=./header/
QXLSX_SOURCEPATH=./source/

# abs. directory sample
# QXLSX_PARENTPATH=/hello/world/
# QXLSX_HEADERPATH=/hello/world/header/
# QXLSX_SOURCEPATH=/hello/world/source/

include(../QXlsx/QXlsx.pri)

Test environment

Test Environment is below.

  • Qt 5.10.1 (MingW/Windows 32bit)
  • Qt 5.9.2 (MingW/Windows 32bit)
  • Qt 5.9.1 (Visual Studio 2017/Windows 64bit)
  • Qt 5.9.1 (Visual Studio 2017/Windows 32bit)
  • Qt 5.9.1 (MingW/Windows 32bit)
  • Qt 5.9.1 (Ubuntu 16/Linux x64)
  • Qt 5.6.0 (MingW/Windows 32bit)
  • Qt 5.5.1 (MingW/Windows 32bit)
  • Qt 5.5.0 (Ubuntu 17/Linux i686)
  • Qt 5.2.0 (Ubuntu 14/Linux x64)
  • Qt 5.0.1 (MingW/Windows 32bit)

To Test

The following tests should be performed.

  • Microsoft Excel
  • Google Spreadsheet
  • LibreOffice Calc Spreasheet

Contacts

Description
No description provided
Readme MIT 9.5 MiB
Languages
C++ 76.5%
C 20.3%
QMake 1.7%
CMake 1.3%
QML 0.1%