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>
|
2020-07-18 21:01:58 +09:00
|
|
|
#include <QColor>
|
|
|
|
#include <QImage>
|
|
|
|
#include <QRgb>
|
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-07-18 21:01:58 +09:00
|
|
|
int test95( 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-07-18 21:01:58 +09:00
|
|
|
return test95( params );
|
2020-06-06 23:31:54 +09:00
|
|
|
}
|
2019-02-06 00:08:18 +09:00
|
|
|
|
2020-07-18 21:01:58 +09:00
|
|
|
int test95( QVector<QVariant> params )
|
2020-06-06 23:31:54 +09:00
|
|
|
{
|
2019-02-15 18:55:56 +09:00
|
|
|
using namespace QXlsx;
|
|
|
|
|
2020-07-18 21:01:58 +09:00
|
|
|
Document xlsx;
|
2020-06-06 23:31:54 +09:00
|
|
|
|
2020-07-18 21:01:58 +09:00
|
|
|
for (int i=0; i<10; ++i)
|
2020-06-06 23:31:54 +09:00
|
|
|
{
|
2020-07-18 21:01:58 +09:00
|
|
|
QImage image(40, 30, QImage::Format_RGB32);
|
|
|
|
image.fill( uint(qrand() % 16581375) );
|
|
|
|
|
|
|
|
int index = xlsx.insertImage( 10*i, 5, image );
|
|
|
|
|
|
|
|
QImage img;
|
|
|
|
if ( xlsx.getImage( index, img ) )
|
|
|
|
{
|
|
|
|
QString filename;
|
|
|
|
filename = QString("image %1.png").arg( index );
|
|
|
|
img.save( filename );
|
|
|
|
|
2020-07-18 22:01:23 +09:00
|
|
|
qDebug() << " [image index] " << index;
|
2020-07-18 21:01:58 +09:00
|
|
|
}
|
2020-06-06 23:31:54 +09:00
|
|
|
}
|
2020-07-18 22:01:23 +09:00
|
|
|
|
|
|
|
qDebug() << " image count : " << xlsx.getImageCount();
|
2020-07-18 21:01:58 +09:00
|
|
|
xlsx.saveAs("image1.xlsx");
|
|
|
|
|
|
|
|
QXlsx::Document xlsx2("image1.xlsx");
|
2020-07-18 22:01:23 +09:00
|
|
|
qDebug() << "xlsx2" ;
|
|
|
|
qDebug() << " image count : " << xlsx.getImageCount();
|
2020-07-18 21:01:58 +09:00
|
|
|
xlsx2.saveAs("image2.xlsx");
|
2019-02-23 20:42:21 +09:00
|
|
|
|
2018-12-20 15:30:29 +09:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|