Mercurial > clickerconvert
changeset 12:21f11f988115
Make sure strings don't start with = and duplicate text instead of formula
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 22 Mar 2016 17:21:33 +0100 |
parents | 79771751d0dc |
children | 101ee762f021 |
files | src/converter.cpp |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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); }