diff src/converter.cpp @ 80:2f81925b0eee

Make html valid and add title
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 05 Oct 2016 14:26:03 +0200
parents a8cd9b27e3d5
children f3481e9e44b2
line wrap: on
line diff
--- a/src/converter.cpp	Wed Oct 05 14:25:35 2016 +0200
+++ b/src/converter.cpp	Wed Oct 05 14:26:03 2016 +0200
@@ -242,14 +242,17 @@
     xlsx.setColumnWidth(26, sum + 1);
     xlsx.setColumnHidden(26, true);
 
+    const QString title = mTitle.isEmpty() ? DEFAULT_TITLE : mTitle;
+
     int row = 1;
-    html << "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"/>"
-            "</head><body><table border=\"0\" width:\"100%\">";
+    html << QStringLiteral("<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\">"
+            "<head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"/>"
+            "<title>%1</title>"
+            "</head><body><table border=\"0\" width=\"100%\">").arg(title.toHtmlEscaped());
     html << QStringLiteral("<tr><th width=\"%1%\"></th>").arg(HTML_COL1_PERCENT);
     html << QStringLiteral("<th width=\"%1%\"></th>").arg(HTML_COL2_PERCENT);
     html << QStringLiteral("<th width=\"%1%\"></th>").arg(HTML_COL3_PERCENT);
 
-    const QString title = mTitle.isEmpty() ? DEFAULT_TITLE : mTitle;
     // Set the title of the Questionaire
     xlsx.write(row++, 1, title, mTitleFmt);
     html << mTitleStyle.arg(title.toHtmlEscaped());
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)