# HG changeset patch # User Andre Heinecke # Date 1458663693 -3600 # Node ID 21f11f988115de3f07bef1f1732dc41f9e30a012 # Parent 79771751d0dcda2a0b2d1ba0d7db6b44522d3d1d Make sure strings don't start with = and duplicate text instead of formula diff -r 79771751d0dc -r 21f11f988115 src/converter.cpp --- a/src/converter.cpp Tue Mar 22 16:45:51 2016 +0100 +++ b/src/converter.cpp Tue Mar 22 17:21:33 2016 +0100 @@ -154,7 +154,11 @@ cursor = choiceMatch.capturedEnd(); /* Write the values */ - xlsx.write(row, 1, choiceMatch.captured(1), mChoiceTextFmt); + QString choiceName = choiceMatch.captured(1).trimmed(); + if (choiceName.startsWith("=")) { + choiceName = " " + choiceName; + } + xlsx.write(row, 1, choiceName, mChoiceTextFmt); bool ok; double percent = choiceMatch.captured(3).toDouble(&ok); if (!ok) { @@ -205,6 +209,7 @@ qDebug() << "cursor is at: " << cursor; qDebug() << "text match starts at: " << textMatch.capturedStart(); xlsx.write(row - 1, 26, combined, mFreeTextFmt); + xlsx.write(row - 1, 1, combined, mFreeTextFmt); cursor = textMatch.capturedEnd(); textMatch = freetxtEx.match(input, cursor); continue; @@ -213,6 +218,9 @@ QString text = textMatch.captured(1).trimmed(); qDebug() << "Found free text: " << text; + if (text.startsWith("=")) { + text = " " + text; + } /* Merge the cells */ xlsx.mergeCells(QString("A%1:C%1").arg(row), mFreeTextFmt); @@ -222,7 +230,7 @@ */ /* Write the values */ xlsx.write(QString("Z%1").arg(row), text, mFreeTextFmt); - xlsx.write(row, 1, QString("=Z%1").arg(row)); + xlsx.write(row, 1, text, mFreeTextFmt); row++; textMatch = freetxtEx.match(input, cursor); }