diff --git a/IssueTest/91.xlsx b/IssueTest/91.xlsx new file mode 100644 index 0000000..d225117 Binary files /dev/null and b/IssueTest/91.xlsx differ diff --git a/IssueTest/IssueTest.pro b/IssueTest/IssueTest.pro index 4c8bf41..82ad881 100644 --- a/IssueTest/IssueTest.pro +++ b/IssueTest/IssueTest.pro @@ -36,3 +36,6 @@ DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ main.cpp \ test.cpp + +RESOURCES += \ +test.qrc diff --git a/IssueTest/test.cpp b/IssueTest/test.cpp index 26d1fbd..b04e270 100644 --- a/IssueTest/test.cpp +++ b/IssueTest/test.cpp @@ -18,35 +18,30 @@ using namespace std; #include "xlsxrichstring.h" #include "xlsxworkbook.h" -// int test( QVector params ); +int test91( QVector params ); int test( QVector params ) { qDebug() << "[debug] current path : " << QDir::currentPath(); + return test91( params ); +} +int test91( QVector params ) +{ using namespace QXlsx; - Document doc1; + Document doc(":/91.xlsx"); // made by ms excel 2019 + if (!doc.isLoadPackage()) { + qDebug() << "Failed to load xlsx."; + return (-1); + } - /* - 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 ); - - doc1.saveAs("test10.xlsx"); + auto tmpCell = doc.cellAt(2, 2); + if(tmpCell) + { + QString str = tmpCell->value().toString(); + qDebug() << str; + } return 0; } diff --git a/IssueTest/test.qrc b/IssueTest/test.qrc new file mode 100644 index 0000000..ce13123 --- /dev/null +++ b/IssueTest/test.qrc @@ -0,0 +1,5 @@ + + + 91.xlsx + + \ No newline at end of file