1、安裝ActivePerl
2、打開pro文件,直接編譯即可
第一個簡單實例:
#include "xlsxcellrange.h"
#include "xlsxchart.h"
#include "xlsxchartsheet.h"
#include "xlsxdocument.h"
#include "xlsxrichstring.h"
#include "xlsxworkbook.h"
using namespace QXlsx;
? QXlsx::Document xlsxW;
int row = 1;
int col = 1; //
? ? // xlsxW.write("A1", "Hello Qt!"); // write "Hello Qt!" to cell(A,1). it's shared string.
QVariant writeValue = QString("Hello Qt!");
xlsxW.write(row, col, writeValue);
? ? if (xlsxW.saveAs("Test.xlsx")) // save the document as 'Test.xlsx'
{
qDebug() << "[debug] success to write xlsx file";
}
else {
qDebug() << "[debug][error] failed to write xlsx file";
}