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

update markdown

This commit is contained in:
Jay Two 2018-11-28 17:30:26 +09:00
parent 118311edf8
commit 26dddeb3c9

View File

@ -15,27 +15,27 @@ using namespace QXlsx;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
// [1] Writing excel file(*.xlsx) // [1] Writing excel file(*.xlsx)
QXlsx::Document xlsxW; QXlsx::Document xlsxW;
xlsxW.write("A1", "Hello Qt!"); // write "Hello Qt!" to cell(A,1). it's shared string. xlsxW.write("A1", "Hello Qt!"); // write "Hello Qt!" to cell(A,1). it's shared string.
xlsxW.saveAs("Test.xlsx"); // save the document as 'Test.xlsx' xlsxW.saveAs("Test.xlsx"); // save the document as 'Test.xlsx'
// [2] Reading excel file(*.xlsx) // [2] Reading excel file(*.xlsx)
Document xlsxR("Test.xlsx"); // load excel file Document xlsxR("Test.xlsx"); // load excel file
if (xlsxR.isLoadPackage()) if (xlsxR.isLoadPackage())
{ {
int row = 1; int col = 1; int row = 1; int col = 1;
Cell* cell = xlsxR.cellAt(row, col); // get cell pointer. Cell* cell = xlsxR.cellAt(row, col); // get cell pointer.
if ( cell != NULL ) if ( cell != NULL )
{ {
QVariant var = cell->readValue(); // read cell value (number(double), QDateTime, QString ...) QVariant var = cell->readValue(); // read cell value (number(double), QDateTime, QString ...)
qDebug() << var; // display value qDebug() << var; // display value
} }
} }
return 0; return 0;
} }
``` ```