1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-01-30 05:02:52 +08:00
QXlsx/IssueTest/test.cpp

54 lines
965 B
C++
Raw Normal View History

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"
// int test( 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();
2019-02-06 00:08:18 +09:00
2019-02-15 18:55:56 +09:00
using namespace QXlsx;
Document doc1;
/*
I simply added "0.####" to numberformat.xlsx:
//Custom number formats
QStringList numFormats;
numFormats
<< "Qt #"
<< "yyyy-mmm-dd"
<< "$ #,##0.00"
<< "[red]0.00"
<< "0.####";
*/
Format fmt;
fmt.setNumberFormat( "0.####" );
// doc1.write( 1, 1, int(30), fmt );
doc1.write( 1, 2, double(30), fmt );
2019-02-15 18:55:56 +09:00
doc1.saveAs("test10.xlsx");
2019-02-23 20:42:21 +09:00
2018-12-20 15:30:29 +09:00
return 0;
}