diff --git a/examples/xlsx/documentproperty/main.cpp b/examples/xlsx/documentproperty/main.cpp index 6cb38cb..a87c222 100644 --- a/examples/xlsx/documentproperty/main.cpp +++ b/examples/xlsx/documentproperty/main.cpp @@ -1,5 +1,5 @@ #include -#include "xlsxworkbook.h" +#include "xlsxdocument.h" #ifdef Q_OS_MAC # define DATA_PATH "../../../" @@ -9,20 +9,20 @@ int main() { - QXlsx::Workbook workbook; + QXlsx::Document xlsx; /* These properties are visible when you use the Office Button -> Prepare -> Properties option in Excel and are also available to external applications that read or index windows files */ - workbook.setProperty("title", "This is an example spreadsheet"); - workbook.setProperty("subject", "With document properties"); - workbook.setProperty("creator", "Debao Zhang"); - workbook.setProperty("company", "HMICN"); - workbook.setProperty("category", "Example spreadsheets"); - workbook.setProperty("keywords", "Sample, Example, Properties"); - workbook.setProperty("description", "Created with Qt Xlsx"); + xlsx.setDocumentProperty("title", "This is an example spreadsheet"); + xlsx.setDocumentProperty("subject", "With document properties"); + xlsx.setDocumentProperty("creator", "Debao Zhang"); + xlsx.setDocumentProperty("company", "HMICN"); + xlsx.setDocumentProperty("category", "Example spreadsheets"); + xlsx.setDocumentProperty("keywords", "Sample, Example, Properties"); + xlsx.setDocumentProperty("description", "Created with Qt Xlsx"); - workbook.save(DATA_PATH"Test.xlsx"); + xlsx.saveAs(DATA_PATH"Test.xlsx"); return 0; } diff --git a/examples/xlsx/hello/main.cpp b/examples/xlsx/hello/main.cpp index b2a677a..dd6997e 100755 --- a/examples/xlsx/hello/main.cpp +++ b/examples/xlsx/hello/main.cpp @@ -1,6 +1,5 @@ #include -#include "xlsxworkbook.h" -#include "xlsxworksheet.h" +#include "xlsxdocument.h" #ifdef Q_OS_MAC # define DATA_PATH "../../../" @@ -10,31 +9,30 @@ int main() { - QXlsx::Workbook workbook; - QXlsx::Worksheet *sheet = workbook.addWorksheet(); - sheet->write("A1", "Hello Qt!"); - sheet->write("B3", 12345); - sheet->write("C5", "=44+33"); - sheet->write("D7", true); - sheet->write("E1", "http://qt-project.org"); + QXlsx::Document xlsx; - QXlsx::Worksheet *sheet2 = workbook.addWorksheet(); + //Write to first worksheet. + 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"); + + //Create another worksheet. + xlsx.addWorksheet(); //Rows and columns are zero indexed. //The first cell in a worksheet, "A1", is (0, 0). - sheet2->write(0, 0, "First"); - sheet2->write(1, 0, "Second"); - sheet2->write(2, 0, "Third"); - sheet2->write(3, 0, "Fourth"); - sheet2->write(4, 0, "Total"); - sheet2->write(0, 1, 100); - sheet2->write(1, 1, 200); - sheet2->write(2, 1, 300); - sheet2->write(3, 1, 400); - sheet2->write(4, 1, "=SUM(B1:B4)"); - - workbook.setActivedWorksheet(1); + 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)"); - workbook.save(DATA_PATH"Test.xlsx"); - workbook.save(DATA_PATH"Test.zip"); + xlsx.saveAs(DATA_PATH"Test.xlsx"); return 0; } diff --git a/examples/xlsx/image/main.cpp b/examples/xlsx/image/main.cpp index 9a05111..d293d24 100644 --- a/examples/xlsx/image/main.cpp +++ b/examples/xlsx/image/main.cpp @@ -1,6 +1,5 @@ #include -#include "xlsxworkbook.h" -#include "xlsxworksheet.h" +#include "xlsxdocument.h" #ifdef Q_OS_MAC # define DATA_PATH "../../../" @@ -12,14 +11,13 @@ int main(int argc, char** argv) { QGuiApplication(argc, argv); - QXlsx::Workbook workbook; - QXlsx::Worksheet *sheet = workbook.addWorksheet(); + QXlsx::Document xlsx; + QImage image(400, 300, QImage::Format_RGB32); image.fill(Qt::green); - sheet->insertImage(5, 5, image); + xlsx.insertImage(5, 5, image); - workbook.save(DATA_PATH"Test.xlsx"); -// workbook.save(DATA_PATH"Test2.zip"); + xlsx.saveAs(DATA_PATH"Test.xlsx"); return 0; } diff --git a/examples/xlsx/mergecells/main.cpp b/examples/xlsx/mergecells/main.cpp index 48fd3ef..2909ccc 100644 --- a/examples/xlsx/mergecells/main.cpp +++ b/examples/xlsx/mergecells/main.cpp @@ -1,6 +1,5 @@ #include -#include "xlsxworkbook.h" -#include "xlsxworksheet.h" +#include "xlsxdocument.h" #ifdef Q_OS_MAC # define DATA_PATH "../../../" @@ -12,16 +11,15 @@ int main(int argc, char** argv) { QGuiApplication(argc, argv); - QXlsx::Workbook workbook; - QXlsx::Worksheet *sheet = workbook.addWorksheet(); + QXlsx::Document xlsx; - sheet->write("B1", "Merge Cells"); - sheet->mergeCells("B1:B5"); + xlsx.write("B1", "Merge Cells"); + xlsx.mergeCells("B1:B5"); - sheet->write("E2", "Merge Cells 2"); - sheet->mergeCells("E2:G4"); + xlsx.write("E2", "Merge Cells 2"); + xlsx.mergeCells("E2:G4"); - workbook.save(DATA_PATH"Test.xlsx"); + xlsx.saveAs(DATA_PATH"Test.xlsx"); return 0; } diff --git a/examples/xlsx/style/main.cpp b/examples/xlsx/style/main.cpp index 1d7e3fe..8c49253 100644 --- a/examples/xlsx/style/main.cpp +++ b/examples/xlsx/style/main.cpp @@ -1,6 +1,5 @@ #include -#include "xlsxworkbook.h" -#include "xlsxworksheet.h" +#include "xlsxdocument.h" #include "xlsxformat.h" #ifdef Q_OS_MAC @@ -11,44 +10,42 @@ int main() { - QXlsx::Workbook workbook; - QXlsx::Worksheet *sheet = workbook.addWorksheet(); - - QXlsx::Format *format1 = workbook.addFormat(); + QXlsx::Document xlsx; + QXlsx::Format *format1 = xlsx.createFormat(); format1->setFontColor(QColor(Qt::red)); format1->setFontSize(15); format1->setHorizontalAlignment(QXlsx::Format::AlignHCenter); format1->setBorderStyle(QXlsx::Format::BorderDashDotDot); - sheet->write("A1", "Hello Qt!", format1); - sheet->write("B3", 12345, format1); + xlsx.write("A1", "Hello Qt!", format1); + xlsx.write("B3", 12345, format1); - QXlsx::Format *format2 = workbook.addFormat(); + QXlsx::Format *format2 = xlsx.createFormat(); format2->setFontBold(true); format2->setFontUnderline(QXlsx::Format::FontUnderlineDouble); format2->setFillPattern(QXlsx::Format::PatternLightUp); - sheet->write("C5", "=44+33", format2); - sheet->write("D7", true, format2); + xlsx.write("C5", "=44+33", format2); + xlsx.write("D7", true, format2); - QXlsx::Format *format3 = workbook.addFormat(); + QXlsx::Format *format3 = xlsx.createFormat(); format3->setFontBold(true); format3->setFontColor(QColor(Qt::blue)); format3->setFontSize(20); - sheet->write(10, 0, "Hello Row Style"); - sheet->write(10, 5, "Blue Color"); - sheet->setRow(10, 40, format3); + xlsx.write(10, 0, "Hello Row Style"); + xlsx.write(10, 5, "Blue Color"); + xlsx.setRow(10, 40, format3); - QXlsx::Format *format4 = workbook.addFormat(); + QXlsx::Format *format4 = xlsx.createFormat(); format4->setFontBold(true); format4->setFontColor(QColor(Qt::magenta)); for (int row=20; row<40; row++) for (int col=8; col<15; col++) - sheet->write(row, col, row+col); - sheet->setColumn(8, 15, 5.0, format4); + xlsx.write(row, col, row+col); + xlsx.setColumn(8, 15, 5.0, format4); - QXlsx::Format *format5 = workbook.addFormat(); + QXlsx::Format *format5 = xlsx.createFormat(); format5->setNumberFormat(22); - sheet->write("A5", QDate(2013, 8, 29), format5); + xlsx.write("A5", QDate(2013, 8, 29), format5); - workbook.save(DATA_PATH"TestStyle.xlsx"); + xlsx.saveAs(DATA_PATH"TestStyle.xlsx"); return 0; } diff --git a/src/xlsx/xlsxdocument.cpp b/src/xlsx/xlsxdocument.cpp index d6c3f70..3a63722 100644 --- a/src/xlsx/xlsxdocument.cpp +++ b/src/xlsx/xlsxdocument.cpp @@ -2,20 +2,27 @@ #include "xlsxdocument_p.h" #include "xlsxworkbook.h" #include "xlsxworksheet.h" +#include "xlsxpackage_p.h" #include +#include namespace QXlsx { DocumentPrivate::DocumentPrivate(Document *p) : - q_ptr(p), defaultPackageName(QStringLiteral("Book1")) + q_ptr(p), defaultPackageName(QStringLiteral("Book1.xlsx")) { + workbook = new Workbook(p); +} +void DocumentPrivate::init() +{ + if (workbook->worksheets().size() == 0) + workbook->addWorksheet(); } bool DocumentPrivate::loadPackage(QIODevice *device) { - return false; } @@ -28,6 +35,7 @@ bool DocumentPrivate::loadPackage(QIODevice *device) Document::Document(QObject *parent) : QObject(parent), d_ptr(new DocumentPrivate(this)) { + d_ptr->init(); } Document::Document(const QString &name, QObject *parent) : @@ -39,6 +47,7 @@ Document::Document(const QString &name, QObject *parent) : if (xlsx.open(QFile::ReadOnly)) d_ptr->loadPackage(&xlsx); } + d_ptr->init(); } Document::Document(QIODevice *device, QObject *parent) : @@ -46,21 +55,158 @@ Document::Document(QIODevice *device, QObject *parent) : { if (device && device->isReadable()) d_ptr->loadPackage(device); + d_ptr->init(); +} + +Format *Document::createFormat() +{ + Q_D(Document); + return d->workbook->addFormat(); +} + +int Document::write(const QString row_column, const QVariant &value, Format *format) +{ + return activedWorksheet()->write(row_column, value, format); +} + +int Document::write(int row, int col, const QVariant &value, Format *format) +{ + return activedWorksheet()->write(row, col, value, format); +} + +int Document::insertImage(int row, int column, const QImage &image, double xOffset, double yOffset, double xScale, double yScale) +{ + return activedWorksheet()->insertImage(row, column, image, QPointF(xOffset, yOffset), xScale, yScale); +} + +int Document::mergeCells(const QString &range) +{ + return activedWorksheet()->mergeCells(range); +} + +int Document::unmergeCells(const QString &range) +{ + return activedWorksheet()->unmergeCells(range); +} + +bool Document::setRow(int row, double height, Format *format, bool hidden) +{ + return activedWorksheet()->setRow(row, height, format, hidden); +} + +bool Document::setColumn(int colFirst, int colLast, double width, Format *format, bool hidden) +{ + return activedWorksheet()->setColumn(colFirst, colLast, width, format, hidden); +} + +QString Document::documentProperty(const QString &key) const +{ + Q_D(const Document); + if (d->documentProperties.contains(key)) + return d->documentProperties[key]; + else + return QString(); +} + +/*! + Set the document properties such as Title, Author etc. + + The method can be used to set the document properties of the Excel + file created by Qt Xlsx. These properties are visible when you use the + Office Button -> Prepare -> Properties option in Excel and are also + available to external applications that read or index windows files. + + The properties \a key that can be set are: + + \list + \li title + \li subject + \li creator + \li manager + \li company + \li category + \li keywords + \li description + \li status + \endlist +*/ +void Document::setDocumentProperty(const QString &key, const QString &property) +{ + Q_D(Document); + d->documentProperties[key] = property; +} + +QStringList Document::documentPropertyNames() const +{ + Q_D(const Document); + return d->documentProperties.keys(); +} + +Workbook *Document::workbook() const +{ + Q_D(const Document); + return d->workbook; +} + +bool Document::addWorksheet(const QString &name) +{ + Q_D(Document); + return d->workbook->addWorksheet(name); +} + +bool Document::insertWorkSheet(int index, const QString &name) +{ + Q_D(Document); + return d->workbook->insertWorkSheet(index, name); +} + +Worksheet *Document::activedWorksheet() const +{ + Q_D(const Document); + if (d->workbook->worksheets().size() == 0) + return 0; + + return d->workbook->worksheets().at(d->workbook->activedWorksheet()); +} + +int Document::activedWorksheetIndex() const +{ + Q_D(const Document); + return d->workbook->activedWorksheet(); +} + +void Document::setActivedWorksheetIndex(int index) +{ + Q_D(Document); + d->workbook->setActivedWorksheet(index); } bool Document::save() { - return false; + Q_D(Document); + QString name = d->packageName.isEmpty() ? d->defaultPackageName : d->packageName; + + return saveAs(name); } bool Document::saveAs(const QString &name) { + QFile file(name); + if (file.open(QIODevice::WriteOnly)) + return saveAs(&file); return false; } bool Document::saveAs(QIODevice *device) { - return false; + Q_D(Document); + +// activedWorksheet()->setHidden(false); +// activedWorksheet()->setSelected(true); + + //Create the package based on current workbook + Package package(this); + return package.createPackage(device); } Document::~Document() diff --git a/src/xlsx/xlsxdocument.h b/src/xlsx/xlsxdocument.h index 592eb1e..30acd9c 100644 --- a/src/xlsx/xlsxdocument.h +++ b/src/xlsx/xlsxdocument.h @@ -4,11 +4,15 @@ #include "xlsxglobal.h" #include class QIODevice; +class QImage; namespace QXlsx { class Workbook; class Worksheet; +class Package; +class Format; + class DocumentPrivate; class Q_XLSX_EXPORT Document : public QObject { @@ -17,15 +21,36 @@ class Q_XLSX_EXPORT Document : public QObject public: explicit Document(QObject *parent = 0); - Document(const QString &name, QObject *parent=0); + Document(const QString &xlsxName, QObject *parent=0); Document(QIODevice *device, QObject *parent=0); ~Document(); + Format *createFormat(); + int write(const QString cell, const QVariant &value, Format *format=0); + int write(int row, int col, const QVariant &value, Format *format=0); + int insertImage(int row, int column, const QImage &image, double xOffset=0, double yOffset=0, double xScale=1, double yScale=1); + int mergeCells(const QString &range); + int unmergeCells(const QString &range); + bool setRow(int row, double height, Format* format=0, bool hidden=false); + bool setColumn(int colFirst, int colLast, double width, Format* format=0, bool hidden=false); + + QString documentProperty(const QString &name) const; + void setDocumentProperty(const QString &name, const QString &property); + QStringList documentPropertyNames() const; + + Workbook *workbook() const; + bool addWorksheet(const QString &name = QString()); + bool insertWorkSheet(int index, const QString &name = QString()); + Worksheet *activedWorksheet() const; + int activedWorksheetIndex() const; + void setActivedWorksheetIndex(int index); + bool save(); - bool saveAs(const QString &name); + bool saveAs(const QString &xlsXname); bool saveAs(QIODevice *device); private: + friend class Package; Q_DISABLE_COPY(Document) DocumentPrivate * const d_ptr; }; diff --git a/src/xlsx/xlsxdocument_p.h b/src/xlsx/xlsxdocument_p.h index fa8ae51..733a87a 100644 --- a/src/xlsx/xlsxdocument_p.h +++ b/src/xlsx/xlsxdocument_p.h @@ -2,6 +2,9 @@ #define XLSXDOCUMENT_P_H #include "xlsxdocument.h" +#include "xlsxworkbook.h" + +#include namespace QXlsx { @@ -10,6 +13,7 @@ class DocumentPrivate Q_DECLARE_PUBLIC(Document) public: DocumentPrivate(Document *p); + void init(); bool loadPackage(QIODevice *device); @@ -17,6 +21,8 @@ public: const QString defaultPackageName; //default name when package name not specified QString packageName; //name of the .xlsx file + QMap documentProperties; //core, app and custom properties + Workbook *workbook; }; } diff --git a/src/xlsx/xlsxpackage.cpp b/src/xlsx/xlsxpackage.cpp index 59242fd..88f619e 100644 --- a/src/xlsx/xlsxpackage.cpp +++ b/src/xlsx/xlsxpackage.cpp @@ -76,9 +76,10 @@ namespace QXlsx { elements of the package and writes them into the XLSX file. */ -Package::Package(Workbook *workbook) : - m_workbook(workbook) +Package::Package(Document *document) : + m_document(document) { + m_workbook = m_document->workbook(); m_worksheet_count = 0; m_chartsheet_count = 0; foreach (Worksheet *sheet, m_workbook->worksheets()) { @@ -89,17 +90,33 @@ Package::Package(Workbook *workbook) : } } -bool Package::parsePackage(QIODevice *packageDevice, Document *document) +bool Package::parsePackage(QIODevice *packageDevice) { ZipReader zipReader(packageDevice); QStringList filePaths = zipReader.filePaths(); + if (!filePaths.contains(QLatin1String("_rels/.rel"))) + return false; + Relationships rootRels = readRelsFile(zipReader, QStringLiteral("_rels/.rel")); + + return false; } -bool Package::createPackage(const QString &packageName) +Relationships Package::readRelsFile(ZipReader &zipReader, const QString &filePath) +{ + QByteArray relsData = zipReader.fileData(filePath); + QBuffer buffer(&relsData); + buffer.open(QIODevice::ReadOnly); + + Relationships rels; + rels.loadFromXmlFile(&buffer); + return rels; +} + +bool Package::createPackage(QIODevice *package) { - ZipWriter zipWriter(packageName); + ZipWriter zipWriter(package); if (zipWriter.error()) return false; @@ -208,8 +225,8 @@ void Package::writeDocPropsAppFile(ZipWriter &zipWriter) { DocPropsApp props; - foreach (QByteArray name, m_workbook->dynamicPropertyNames()) - props.setProperty(name.data(), m_workbook->property(name.data())); + foreach (QString name, m_document->documentPropertyNames()) + props.setProperty(name.toUtf8().data(), m_document->documentProperty(name)); if (m_worksheet_count) props.addHeadingPair(QStringLiteral("Worksheets"), m_worksheet_count); @@ -239,8 +256,8 @@ void Package::writeDocPropsCoreFile(ZipWriter &zipWriter) { DocPropsCore props; - foreach (QByteArray name, m_workbook->dynamicPropertyNames()) - props.setProperty(name.data(), m_workbook->property(name.data())); + foreach (QString name, m_document->documentPropertyNames()) + props.setProperty(name.toUtf8().data(), m_document->documentProperty(name)); QByteArray data; QBuffer buffer(&data); diff --git a/src/xlsx/xlsxpackage_p.h b/src/xlsx/xlsxpackage_p.h index b5b5f2b..e53ec8a 100644 --- a/src/xlsx/xlsxpackage_p.h +++ b/src/xlsx/xlsxpackage_p.h @@ -33,17 +33,21 @@ namespace QXlsx { class Workbook; class ZipWriter; +class ZipReader; class Document; +class Relationships; class XLSX_AUTOTEST_EXPORT Package { public: - Package(Workbook *workbook); + Package(Document *document); - bool parsePackage(QIODevice *packageDevice, Document *document); - bool createPackage(const QString &packageName); + bool parsePackage(QIODevice *packageDevice); + bool createPackage(QIODevice *package); private: + Relationships readRelsFile(ZipReader &reader, const QString &filePath); + void writeWorksheetFiles(ZipWriter &zipWriter); // void writeChartsheetFiles(ZipWriter &zipWriter); void writeWorkbookFile(ZipWriter &zipWriter); @@ -66,7 +70,8 @@ private: void writeImageFiles(ZipWriter &zipWriter); // void writeVbaProjectFiles(ZipWriter &zipWriter); - Workbook * m_workbook; + Document *m_document; + Workbook *m_workbook; int m_worksheet_count; int m_chartsheet_count; }; diff --git a/src/xlsx/xlsxworkbook.cpp b/src/xlsx/xlsxworkbook.cpp index 96c432a..87b650e 100755 --- a/src/xlsx/xlsxworkbook.cpp +++ b/src/xlsx/xlsxworkbook.cpp @@ -32,6 +32,8 @@ #include "xlsxxmlwriter_p.h" #include "xlsxworksheet_p.h" +#include + namespace QXlsx { WorkbookPrivate::WorkbookPrivate(Workbook *q) : @@ -52,31 +54,6 @@ WorkbookPrivate::WorkbookPrivate(Workbook *q) : table_count = 0; } -/*! - \fn void Workbook::setProperty(const char *key, const QString &value) - - Set the document properties such as Title, Author etc. - - The method can be used to set the document properties of the Excel - file created by Qt Xlsx. These properties are visible when you use the - Office Button -> Prepare -> Properties option in Excel and are also - available to external applications that read or index windows files. - - The properties \a key that can be set are: - - \list - \li title - \li subject - \li creator - \li manager - \li company - \li category - \li keywords - \li description - \li status - \endlist -*/ - Workbook::Workbook(QObject *parent) : QObject(parent), d_ptr(new WorkbookPrivate(this)) { @@ -88,26 +65,6 @@ Workbook::~Workbook() delete d_ptr; } -bool Workbook::save(const QString &name) -{ - Q_D(Workbook); - - //Add a default worksheet if non have been added. - if (d->worksheets.size() == 0) - addWorksheet(); - - //Ensure that at least one worksheet has been selected. - int actIndex = d->activesheet; - if (actIndex < 0 || actIndex >= d->worksheets.size()) - actIndex = 0; - d->worksheets[actIndex]->setHidden(false); - d->worksheets[actIndex]->setSelected(true); - - //Create the package based on current workbook - Package package(this); - return package.createPackage(name); -} - bool Workbook::isDate1904() const { Q_D(const Workbook); @@ -183,6 +140,7 @@ Worksheet *Workbook::insertWorkSheet(int index, const QString &name) Worksheet *sheet = new Worksheet(worksheetName, this); d->worksheets.insert(index, sheet); + d->activesheet = index; return sheet; } @@ -195,6 +153,10 @@ int Workbook::activedWorksheet() const void Workbook::setActivedWorksheet(int index) { Q_D(Workbook); + if (index < 0 || index >= d->worksheets.size()) { + //warning + return; + } d->activesheet = index; } diff --git a/src/xlsx/xlsxworkbook.h b/src/xlsx/xlsxworkbook.h index 989560b..dc55783 100755 --- a/src/xlsx/xlsxworkbook.h +++ b/src/xlsx/xlsxworkbook.h @@ -63,12 +63,6 @@ public: bool isStringsToNumbersEnabled() const; void setStringsToNumbersEnabled(bool enable=true); -#ifdef Q_QDOC - bool setProperty(const char *key, const QString &value); -#endif - - bool save(const QString &name); - private: friend class Package; friend class Worksheet; diff --git a/src/xlsx/xlsxzipwriter.cpp b/src/xlsx/xlsxzipwriter.cpp index 3bd91e3..66f7118 100644 --- a/src/xlsx/xlsxzipwriter.cpp +++ b/src/xlsx/xlsxzipwriter.cpp @@ -35,6 +35,13 @@ ZipWriter::ZipWriter(const QString &filePath, QObject *parent) : m_writer->setCompressionPolicy(QZipWriter::NeverCompress); } +ZipWriter::ZipWriter(QIODevice *device, QObject *parent) : + QObject(parent) +{ + m_writer = new QZipWriter(device); + m_writer->setCompressionPolicy(QZipWriter::NeverCompress); +} + ZipWriter::~ZipWriter() { delete m_writer; diff --git a/src/xlsx/xlsxzipwriter_p.h b/src/xlsx/xlsxzipwriter_p.h index 9814c6e..1302ebc 100644 --- a/src/xlsx/xlsxzipwriter_p.h +++ b/src/xlsx/xlsxzipwriter_p.h @@ -36,6 +36,7 @@ class ZipWriter : public QObject Q_OBJECT public: explicit ZipWriter(const QString &filePath, QObject *parent = 0); + explicit ZipWriter(QIODevice *device, QObject *parent = 0); ~ZipWriter(); void addFile(const QString &filePath, QIODevice *device);