Improve the documentation of the examples

This commit is contained in:
Debao Zhang
2013-10-19 15:00:54 +08:00
parent f8ca19f14b
commit 81abb19c8c
7 changed files with 42 additions and 29 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+11 -2
View File
@@ -1,11 +1,20 @@
/*!
\title Qt Xlsx Examples - Hello World
\example hello
\title Xlsx Hello Example
\brief This is a simplest xlsx examples.
\ingroup qtxlsx
This example demonstrates how to generate a
simplest .xlsx file with Qt Xlsx Library.
\image hello.png
Create an object of the class QXlsx::Document.
\snippet hello/main.cpp 0
Set the cells of worksheet.
\snippet hello/main.cpp 1
Save it.
\snippet hello/main.cpp 2
*/
+3
View File
@@ -3,4 +3,7 @@ TARGET = hello
#include(../../../src/xlsx/qtxlsx.pri)
QT+=xlsx
CONFIG += console
CONFIG -= app_bundle
SOURCES += main.cpp
+11 -26
View File
@@ -1,38 +1,23 @@
#include <QtCore>
#include "xlsxdocument.h"
#ifdef Q_OS_MAC
# define DATA_PATH "../../../"
#else
# define DATA_PATH "./"
#endif
int main()
{
//![0]
QXlsx::Document xlsx;
//![0]
//Write to first worksheet.
//![1]
xlsx.write("A1", "Hello Qt!");
xlsx.write("B3", 12345);
xlsx.write("C5", "=44+33");
xlsx.write("D7", true);
xlsx.write("E1", "http://qt-project.org");
xlsx.write("A2", 12345);
xlsx.write("A3", "=44+33");
xlsx.write("A4", true);
xlsx.write("A5", "http://qt-project.org");
//![1]
//Create another worksheet.
xlsx.addWorksheet();
//Rows and columns are zero indexed.
//The first cell in a worksheet, "A1", is (0, 0).
xlsx.write(0, 0, "First");
xlsx.write(1, 0, "Second");
xlsx.write(2, 0, "Third");
xlsx.write(3, 0, "Fourth");
xlsx.write(4, 0, "Total");
xlsx.write(0, 1, 100);
xlsx.write(1, 1, 200);
xlsx.write(2, 1, 300);
xlsx.write(3, 1, 400);
// xlsx.write(4, 1, "=SUM(B1:B4)");
//![2]
xlsx.save();
//![2]
xlsx.saveAs(DATA_PATH"Test.xlsx");
return 0;
}