Make constructor of Workbook private

This commit is contained in:
Debao Zhang
2013-09-11 17:12:56 +08:00
parent 5817ebdbfd
commit 6ee507b0d8
4 changed files with 54 additions and 26 deletions
+26
View File
@@ -33,6 +33,7 @@
#include "xlsxworksheet_p.h"
#include <QFile>
#include <QBuffer>
namespace QXlsx {
@@ -281,4 +282,29 @@ void Workbook::saveToXmlFile(QIODevice *device)
writer.writeEndDocument();
}
QByteArray Workbook::saveToXmlData()
{
QByteArray data;
QBuffer buffer(&data);
buffer.open(QIODevice::WriteOnly);
saveToXmlFile(&buffer);
return data;
}
QSharedPointer<Workbook> Workbook::loadFromXmlFile(QIODevice *device)
{
return QSharedPointer<Workbook>(new Workbook);
}
QSharedPointer<Workbook> Workbook::loadFromXmlData(const QByteArray &data)
{
QBuffer buffer;
buffer.setData(data);
buffer.open(QIODevice::ReadOnly);
return loadFromXmlFile(&buffer);
}
} //namespace