// test.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #include "xlsxdocument.h" #include "xlsxchartsheet.h" #include "xlsxcellrange.h" #include "xlsxchart.h" #include "xlsxrichstring.h" #include "xlsxworkbook.h" #ifdef Q_OS_WIN #include "colorprintf.h" // https://github.com/VittGam/colorprintf #endif int test( QVector params ); int test( QVector params ) { qDebug() << "[debug] current path : " << QDir::currentPath(); QFile fileNames(":/xlsx_files/dir2.txt"); if ( !fileNames.open(QIODevice::ReadOnly | QIODevice::Text) ) { qDebug() << "[debug] failed to load dir2.txt"; return (-1); } while (!fileNames.atEnd()) { QByteArray line = fileNames.readLine(); QString strArg(line); QString strArg2 = strArg.simplified(); QString strArg3 = strArg2.trimmed(); QString currentFilename = QString(":/xlsx_files/%1").arg(strArg3); { using namespace QXlsx; Document output2(currentFilename); if ( output2.load() ) { if ( output2.saveAs( strArg3 ) ) { #ifdef Q_OS_WIN colorprintf(3, "[debug] xlsx is saved. %s\n", strArg3.toStdString().c_str() ); #else qDebug() << "[debug] xlsx is saved. " << strArg3; #endif } else { #ifdef Q_OS_WIN colorprintf(0, "[debug] failed to save. %s\n", strArg3.toStdString().c_str() ); #else qCritical() << "[debug] failed to save. " << strArg3; #endif } } else { #ifdef Q_OS_WIN colorprintf(0, "[debug] failed to load. %s\n", strArg3.toStdString().c_str() ); #else qCritical() << "[debug] failed to load. " << strArg3; #endif } } } return 0; }