2017-10-08 15:42:29 +09:00
|
|
|
# QXlsx
|
2017-08-20 17:04:19 +09:00
|
|
|
|
2017-09-02 14:40:33 +09:00
|
|
|
> *Read this in other languages: [English](README.md), [한국어](README.ko.md)*
|
2017-08-20 17:04:19 +09:00
|
|
|
|
2017-10-21 16:41:24 +09:00
|
|
|
![](etc/IMG_0016.PNG)
|
2017-10-05 14:35:06 +09:00
|
|
|
|
2017-09-14 20:27:18 +09:00
|
|
|
## Excel reader/writer library
|
2017-08-20 18:06:55 +09:00
|
|
|
|
2017-10-21 16:41:24 +09:00
|
|
|
* QXlsx is excel file(*.xlsx) reader/writer library.
|
2017-09-05 13:21:51 +09:00
|
|
|
* It is written for static library using Qt 5.
|
2017-08-19 00:09:38 +09:00
|
|
|
|
2017-10-09 21:11:25 +09:00
|
|
|
## License
|
2017-10-10 19:20:01 +09:00
|
|
|
* QXlsx is licensed under the GPL License https://www.gnu.org/licenses/gpl-3.0.en.html
|
2017-11-10 23:14:27 +09:00
|
|
|
* QtXlsx Debao Zhang(2014) : https://github.com/dbzhang800/QtXlsxWriter
|
2017-10-09 21:11:25 +09:00
|
|
|
* Qt License (see Qt Company site) : https://www.qt.io/
|
|
|
|
|
2017-10-21 16:41:24 +09:00
|
|
|
## Hello excel
|
2017-10-09 21:08:32 +09:00
|
|
|
### Writing excel file
|
|
|
|
```cpp
|
|
|
|
QXlsx::Document xlsx;
|
2017-10-17 18:34:37 +09:00
|
|
|
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'
|
2017-10-09 21:08:32 +09:00
|
|
|
```
|
|
|
|
### Reading excel file
|
|
|
|
```cpp
|
2017-10-17 19:01:47 +09:00
|
|
|
Document xlsx("Test.xlsx"); // load excel file
|
|
|
|
if (!xlsx.isLoadPackage()) { // failed to load excel
|
2017-10-21 16:41:24 +09:00
|
|
|
return;
|
2017-10-17 19:01:47 +09:00
|
|
|
}
|
2017-10-17 19:02:56 +09:00
|
|
|
int row = 1; int col = 2;
|
|
|
|
Cell* cell = xlsx.cellAt(row, col); // get cell pointer. (row is 1. column is 2.)
|
2017-10-09 21:08:32 +09:00
|
|
|
if ( cell == NULL )
|
2017-10-21 16:41:24 +09:00
|
|
|
continue; // cell vaule is not set
|
2017-10-17 18:33:26 +09:00
|
|
|
QVariant var = cell->readValue(); // read cell value (number(double), QDateTime, QString ...)
|
|
|
|
qint32 styleNo = cell->styleNumber(); // read cell style number
|
2017-10-09 21:08:32 +09:00
|
|
|
if ( styleNo >= 0 )
|
|
|
|
qDebug() << row << " " << var << " , style:" << styleNo;
|
|
|
|
else
|
|
|
|
qDebug() << row << " " << var;
|
|
|
|
```
|
|
|
|
|
|
|
|
## How to build
|
|
|
|
* see https://github.com/j2doll/QXlsx/wiki
|
|
|
|
|
2017-09-02 14:41:08 +09:00
|
|
|
## Test environment
|
2017-10-21 16:47:27 +09:00
|
|
|
* see https://github.com/j2doll/QXlsx/wiki/Test-Environment
|
2017-10-17 18:48:33 +09:00
|
|
|
|
|
|
|
## To test
|
|
|
|
The following tests should be performed.
|
|
|
|
- testing Microsoft Office(Excel) Online
|
|
|
|
- testing Google Docs(Spreadsheet)
|
|
|
|
- testing LibreOffice
|
|
|
|
|
2017-10-05 15:18:55 +09:00
|
|
|
## Contact
|
2017-08-20 18:13:27 +09:00
|
|
|
* [j2doll@gmail.com](mailto:j2doll@gmail.com)
|
2017-10-21 16:41:24 +09:00
|
|
|
* Hi! My native language is not English. My English is not fluent. Please use EASY English. :-)
|