Code refactoring: Clean up code of QXlsx::Package

We should merge the class Package with the class Document
This commit is contained in:
Debao Zhang
2014-01-06 11:32:20 +08:00
parent bf951872c7
commit d1818c7fd1
8 changed files with 40 additions and 52 deletions
+10
View File
@@ -26,6 +26,7 @@
#include <QXmlStreamWriter>
#include <QFile>
#include <QMapIterator>
#include <QBuffer>
namespace QXlsx {
@@ -111,6 +112,15 @@ void ContentTypes::addVbaProject()
addOverride(QStringLiteral("bin"), QStringLiteral("application/vnd.ms-office.vbaProject"));
}
QByteArray ContentTypes::saveToXmlData() const
{
QByteArray data;
QBuffer buffer(&data);
buffer.open(QIODevice::WriteOnly);
saveToXmlFile(&buffer);
return data;
}
void ContentTypes::saveToXmlFile(QIODevice *device) const
{
QXmlStreamWriter writer(device);