2018-12-20 15:30:29 +09:00
|
|
|
// test.cpp
|
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QtCore>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QVariant>
|
|
|
|
#include <QDebug>
|
2019-02-06 00:08:18 +09:00
|
|
|
#include <QDir>
|
2018-12-20 15:30:29 +09:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
#include "xlsxdocument.h"
|
|
|
|
#include "xlsxchartsheet.h"
|
|
|
|
#include "xlsxcellrange.h"
|
|
|
|
#include "xlsxchart.h"
|
|
|
|
#include "xlsxrichstring.h"
|
|
|
|
#include "xlsxworkbook.h"
|
|
|
|
|
2020-06-06 23:31:54 +09:00
|
|
|
int test91( QVector<QVariant> params );
|
2019-06-01 23:54:22 +09:00
|
|
|
|
2019-02-06 00:08:18 +09:00
|
|
|
int test( QVector<QVariant> params )
|
2018-12-20 15:30:29 +09:00
|
|
|
{
|
2019-02-23 20:42:21 +09:00
|
|
|
qDebug() << "[debug] current path : " << QDir::currentPath();
|
2020-06-06 23:31:54 +09:00
|
|
|
return test91( params );
|
|
|
|
}
|
2019-02-06 00:08:18 +09:00
|
|
|
|
2020-06-06 23:35:49 +09:00
|
|
|
// tested in Qt 5.14.1, MingW 7.3.0 64bit
|
2020-06-06 23:31:54 +09:00
|
|
|
int test91( QVector<QVariant> params )
|
|
|
|
{
|
2019-02-15 18:55:56 +09:00
|
|
|
using namespace QXlsx;
|
|
|
|
|
2020-06-06 23:31:54 +09:00
|
|
|
Document doc(":/91.xlsx"); // made by ms excel 2019
|
|
|
|
if (!doc.isLoadPackage()) {
|
|
|
|
qDebug() << "Failed to load xlsx.";
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
2020-06-06 23:35:49 +09:00
|
|
|
QXlsx::CellRange range = doc.dimension();
|
|
|
|
for (int i = 2; i < range.rowCount() + 1; i++)
|
2020-06-06 23:31:54 +09:00
|
|
|
{
|
2020-06-06 23:35:49 +09:00
|
|
|
for (int j = 1; j < range.columnCount()+1; j++)
|
|
|
|
{
|
|
|
|
QString dataStr;
|
|
|
|
auto tmpCell = doc.cellAt(i, j);
|
|
|
|
if(tmpCell)
|
|
|
|
{
|
|
|
|
dataStr = tmpCell->value().toString().trimmed();
|
|
|
|
qDebug() << dataStr;
|
|
|
|
}
|
|
|
|
}
|
2020-06-06 23:31:54 +09:00
|
|
|
}
|
2019-02-23 20:42:21 +09:00
|
|
|
|
2018-12-20 15:30:29 +09:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|