Browse Source

Issue #64: Don't given count mismatch warning when the attribute doesn't exist.

master
Debao Zhang 10 years ago
parent
commit
9563a0463e
  1. 4
      src/xlsx/xlsxsharedstrings.cpp

4
src/xlsx/xlsxsharedstrings.cpp

@ -370,11 +370,13 @@ bool SharedStrings::loadFromXmlFile(QIODevice *device)
{ {
QXmlStreamReader reader(device); QXmlStreamReader reader(device);
int count = 0; int count = 0;
bool hasUniqueCountAttr=true;
while (!reader.atEnd()) { while (!reader.atEnd()) {
QXmlStreamReader::TokenType token = reader.readNext(); QXmlStreamReader::TokenType token = reader.readNext();
if (token == QXmlStreamReader::StartElement) { if (token == QXmlStreamReader::StartElement) {
if (reader.name() == QLatin1String("sst")) { if (reader.name() == QLatin1String("sst")) {
QXmlStreamAttributes attributes = reader.attributes(); QXmlStreamAttributes attributes = reader.attributes();
if ((hasUniqueCountAttr = attributes.hasAttribute(QLatin1String("uniqueCount"))))
count = attributes.value(QLatin1String("uniqueCount")).toString().toInt(); count = attributes.value(QLatin1String("uniqueCount")).toString().toInt();
} else if (reader.name() == QLatin1String("si")) { } else if (reader.name() == QLatin1String("si")) {
readString(reader); readString(reader);
@ -382,7 +384,7 @@ bool SharedStrings::loadFromXmlFile(QIODevice *device)
} }
} }
if (m_stringList.size() != count) { if (hasUniqueCountAttr && m_stringList.size() != count) {
qDebug("Error: Shared string count"); qDebug("Error: Shared string count");
return false; return false;
} }

Loading…
Cancel
Save