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

39 lines
616 B
C++
Raw Normal View History

2017-08-16 20:58:34 +09:00
//
// main.cpp
//
#include <QCoreApplication>
#include <QtCore>
2017-08-26 13:02:08 +09:00
#include <iostream>
using namespace std;
2017-08-16 20:58:34 +09:00
#include "xlsxdocument.h"
2017-08-26 13:02:08 +09:00
using namespace QXlsx;
2017-08-16 20:58:34 +09:00
2017-08-26 13:02:08 +09:00
void Test1();
2017-08-26 02:53:20 +00:00
2017-08-16 20:58:34 +09:00
int main(int argc, char *argv[])
2017-08-26 13:02:08 +09:00
{
Test1();
return 0;
}
void Test1()
2017-08-16 20:58:34 +09:00
{
2017-08-26 02:53:20 +00:00
Document xlsx;
2017-08-26 13:02:08 +09:00
2017-08-16 20:58:34 +09:00
xlsx.write("A1", "Hello Qt!");
2017-08-26 13:02:08 +09:00
xlsx.write("A2", 12345);
xlsx.write("A3", "=44+33");
xlsx.write("A4", true);
xlsx.write("A5", "http://qt-project.org");
xlsx.write("A6", QDate(2013, 12, 27));
xlsx.write("A7", QTime(6, 30));
if (!xlsx.saveAs("Test.xlsx"))
cout << "failed to save excel file" << endl;
2017-08-16 20:58:34 +09:00
}
2017-08-26 13:02:08 +09:00