We can read and modify existing simple .xlsx file now
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
/*!
|
||||
\title Xlsx Readwrite Example
|
||||
\example readwrite
|
||||
\brief Open an existing xlsx file, modify and save it.
|
||||
|
||||
\ingroup qtxlsx
|
||||
|
||||
This example demonstrates how to modify an existing
|
||||
.xlsx file with Qt Xlsx Library.
|
||||
*/
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "xlsxdocument.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
//Generate a simple xlsx file at first.
|
||||
QXlsx::Document xlsx;
|
||||
xlsx.write("A1", "Hello Qt!");
|
||||
xlsx.write("A2", 500);
|
||||
xlsx.saveAs("first.xlsx");
|
||||
|
||||
//Read, edit, save
|
||||
QXlsx::Document xlsx2("first.xlsx");
|
||||
xlsx2.addWorksheet("Second");
|
||||
xlsx2.write("A1", "Hello Qt again!");
|
||||
xlsx2.saveAs("second.xlsx");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
TARGET = mergecells
|
||||
|
||||
#include(../../../src/xlsx/qtxlsx.pri)
|
||||
QT += xlsx
|
||||
|
||||
TARGET = readwrite
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += main.cpp
|
||||
Reference in New Issue
Block a user