Don't generate externalReferences tags if non externalLinks exists

This commit is contained in:
Debao Zhang
2014-02-26 13:16:38 +08:00
parent aa885e4377
commit ca0df02acb
+8 -6
View File
@@ -437,13 +437,15 @@ void Workbook::saveToXmlFile(QIODevice *device) const
} }
writer.writeEndElement();//sheets writer.writeEndElement();//sheets
writer.writeStartElement(QStringLiteral("externalReferences")); if (d->externalLinks.size() > 0) {
for (int i=0; i<d->externalLinks.size(); ++i) { writer.writeStartElement(QStringLiteral("externalReferences"));
writer.writeEmptyElement(QStringLiteral("externalReference")); for (int i=0; i<d->externalLinks.size(); ++i) {
d->relationships->addDocumentRelationship(QStringLiteral("/externalLink"), QStringLiteral("externalLinks/externalLink%1.xml").arg(i+1)); writer.writeEmptyElement(QStringLiteral("externalReference"));
writer.writeAttribute(QStringLiteral("r:id"), QStringLiteral("rId%1").arg(d->relationships->count())); d->relationships->addDocumentRelationship(QStringLiteral("/externalLink"), QStringLiteral("externalLinks/externalLink%1.xml").arg(i+1));
writer.writeAttribute(QStringLiteral("r:id"), QStringLiteral("rId%1").arg(d->relationships->count()));
}
writer.writeEndElement();//externalReferences
} }
writer.writeEndElement();//externalReferences
if (!d->definedNamesList.isEmpty()) { if (!d->definedNamesList.isEmpty()) {
writer.writeStartElement(QStringLiteral("definedNames")); writer.writeStartElement(QStringLiteral("definedNames"));