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

duplicate function name : isloadpack..() and load()

This commit is contained in:
Jay Two 2018-12-29 21:57:10 +09:00
parent 02710b2544
commit daef10ae82
5 changed files with 13 additions and 16 deletions

View File

@ -36,14 +36,14 @@ int main(int argc, char *argv[])
// [2] Reading excel file(*.xlsx)
Document xlsxR("Test.xlsx"); // load excel file
if (xlsxR.isLoadPackage())
if (xlsxR.load())
{
int row = 1; int col = 1;
Cell* cell = xlsxR.cellAt(row, col); // get cell pointer.
if ( cell != NULL )
{
QVariant var = cell->readValue(); // read cell value (number(double), QDateTime, QString ...)
qDebug() << var; // display value
qDebug() << var; // display value. it is 'Hello Qt!'.
}
}

View File

@ -1,14 +1,5 @@
// QXlsx
// MIT License
// https://github.com/j2doll/QXlsx
//
// QtXlsx
// https://github.com/dbzhang800/QtXlsxWriter
// http://qtxlsx.debao.me/
// MIT License
//
// main.cpp
// QXlsx // MIT License // https://github.com/j2doll/QXlsx
//
#include <QtGlobal>
@ -37,7 +28,7 @@ int main(int argc, char *argv[])
// [1] Writing excel file(*.xlsx)
QXlsx::Document xlsxW;
xlsxW.write("A1", "Hello Qt!"); // write "Hello Qt!" to cell(A,1). it's shared string.
if (xlsxW.saveAs("Test.xlsx")) // save the document as 'Test.xlsx'
if ( xlsxW.saveAs("Test.xlsx") ) // save the document as 'Test.xlsx'
{
qDebug() << "[debug] success to write xlsx file";
}
@ -50,7 +41,7 @@ int main(int argc, char *argv[])
// [2] Reading excel file(*.xlsx)
Document xlsxR("Test.xlsx"); // load excel file
if (xlsxR.isLoadPackage())
if ( xlsxR.load() )
{
qDebug() << "[debug] success to load xlsx file.";
@ -59,8 +50,7 @@ int main(int argc, char *argv[])
if ( cell != NULL )
{
QVariant var = cell->readValue(); // read cell value (number(double), QDateTime, QString ...)
qDebug() << var; // display value
qDebug() << "[debug] cell(1,1) is " << var; // Display value. It is 'Hello Qt!'.
}
else
{

View File

@ -111,6 +111,7 @@ public:
bool saveAs(QIODevice *device) const;
bool isLoadPackage() const;
bool load() const; // equals to isLoadPackage()
bool changeimage(int filenoinmidea,QString newfile); // add by liufeijin20181025

View File

@ -1066,6 +1066,11 @@ bool Document::isLoadPackage() const
return d->isLoad;
}
bool Document::load() const
{
return isLoadPackage();
}
/*!
* Destroys the document and cleans up.
*/

View File

@ -4,6 +4,7 @@
| Qt | Tool | OS | Build |
| ------ | ------------------ | ------------------------- | ------- |
| 5.12.0 | Visual Studio 2017 | Windows 64bit | :smile: |
| 5.12.0 | MingW 64 bit | Windows 64bit | :smile: |
| 5.11.2 | Visual Studio 2017 | Windows 64bit | :smile: |
| 5.10.1 | MingW | Windows 32bit | :smile: |