diff src/converter.cpp @ 89:80ff6591101a

Fix numVotesString containing spaces in xlsx
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 05 Oct 2016 15:44:29 +0200
parents 08cca723e37d
children ccd1dbea2536
line wrap: on
line diff
--- a/src/converter.cpp	Wed Oct 05 15:43:30 2016 +0200
+++ b/src/converter.cpp	Wed Oct 05 15:44:29 2016 +0200
@@ -337,11 +337,14 @@
                 makeBar(html, percent, doc);
                 xlsx.write(row, 2, percent == 0 ? QVariant() : percent);
                 const QString numStr = choiceMatch.captured("num");
-                const QString numVotesString = QString("%1% | %2 Number of votes").
+                const QString numVotesStringHtml = QString("%1% | %2 Number of votes").
                            arg(percentStr.isEmpty() ? QStringLiteral("0") : percentStr, 8).
                            arg(numStr.isEmpty() ? QStringLiteral("0") : numStr, 3);
-                html << mChoiceVotesStyle.arg(numVotesString);
-                xlsx.write(row, 3, numVotesString, mChoiceVotesFmt);
+                const QString numVotesStringXls = QString("%1% | %2 Number of votes").
+                           arg(percentStr.isEmpty() ? QStringLiteral("0") : percentStr).
+                           arg(numStr.isEmpty() ? QStringLiteral("0") : numStr);
+                html << mChoiceVotesStyle.arg(numVotesStringHtml);
+                xlsx.write(row, 3, numVotesStringXls, mChoiceVotesFmt);
                 xlsx.setRowHeight(row, CHOICE_ROW_HEIGHT);
                 /* As long as we can match a choice which is either before the next question
                    or before the end of the document */
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)