Debao Zhang
11 years ago
8 changed files with 141 additions and 8 deletions
@ -0,0 +1,9 @@ |
|||||
|
TARGET = definename |
||||
|
|
||||
|
#include(../../../src/xlsx/qtxlsx.pri) |
||||
|
QT+=xlsx |
||||
|
|
||||
|
CONFIG += console |
||||
|
CONFIG -= app_bundle |
||||
|
|
||||
|
SOURCES += main.cpp |
@ -0,0 +1,33 @@ |
|||||
|
#include <QtCore> |
||||
|
#include "xlsxdocument.h" |
||||
|
|
||||
|
QTXLSX_USE_NAMESPACE |
||||
|
|
||||
|
int main() |
||||
|
{ |
||||
|
//![0]
|
||||
|
Document xlsx; |
||||
|
for (int i=0; i<10; ++i) { |
||||
|
xlsx.write(i, 0, i); |
||||
|
xlsx.write(i, 1, i*i); |
||||
|
xlsx.write(i, 2, i*i*i); |
||||
|
} |
||||
|
//![0]
|
||||
|
//![1]
|
||||
|
xlsx.defineName("MyCol_1", "=Sheet1!$A$1:$A$10"); |
||||
|
xlsx.defineName("MyCol_2", "=Sheet1!$B$1:$B$10", "This is comments"); |
||||
|
xlsx.defineName("MyCol_3", "=Sheet1!$C$1:$C$10", "", "Sheet1"); |
||||
|
xlsx.defineName("Factor", "=0.5"); |
||||
|
//![1]
|
||||
|
//![2]
|
||||
|
xlsx.write(10, 0, "=SUM(MyCol_1)"); |
||||
|
xlsx.write(10, 1, "=SUM(MyCol_2)"); |
||||
|
xlsx.write(10, 2, "=SUM(MyCol_3)"); |
||||
|
xlsx.write(11, 0, "=SUM(MyCol_1)*Factor"); |
||||
|
xlsx.write(11, 1, "=SUM(MyCol_2)*Factor"); |
||||
|
xlsx.write(11, 2, "=SUM(MyCol_3)*Factor"); |
||||
|
//![2]
|
||||
|
|
||||
|
xlsx.save(); |
||||
|
return 0; |
||||
|
} |
Loading…
Reference in new issue