Print metadata table

feature/build-protobuf
mandlm 2018-11-04 13:57:35 +01:00
parent f8c3dc35fd
commit fcbe356f75
3 changed files with 18 additions and 16 deletions

View File

@ -64,11 +64,6 @@ std::string DataModel::toHtml() const
out << "body {" << std::endl;
out << "font-family:sans-serif;" << std::endl;
out << "}" << std::endl;
out << "table, th, td {" << std::endl;
out << "border: 1px solid black;" << std::endl;
out << "border-collapse: collapse;" << std::endl;
out << "padding: 5px;" << std::endl;
out << "}" << std::endl;
out << "</style>" << std::endl;
out << "</head>" << std::endl;
out << "<body>" << std::endl;

View File

@ -134,26 +134,33 @@ std::string MetaDataModel::toHtml() const
{
std::ostringstream out;
out << "<table>" << std::endl;
out << "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" frame=\"box\" rules=\"all\">"
<< std::endl;
out << "<tr>" << std::endl;
out << "<td>Name, Vorname</td>" << std::endl;
out << "<td>" << m_participant.toStdString() << "</td>" << std::endl;
out << "<td>Untersucher(in)</td>" << std::endl;
out << "<td>" << m_instructor.toStdString() << "</td>" << std::endl;
out << "<td width=\"25%\">Name, Vorname</td>" << std::endl;
out << "<td width=\"25%\">" << m_participant.toHtmlEscaped().toStdString() << "</td>"
<< std::endl;
out << "<td width=\"25%\">Untersucher(in)</td>" << std::endl;
out << "<td width=\"25%\">" << m_instructor.toHtmlEscaped().toStdString() << "</td>"
<< std::endl;
out << "</tr>" << std::endl;
out << "<tr>" << std::endl;
out << "<td>Geburtsdatum</td>" << std::endl;
out << "<td></td>" << std::endl;
out << "<td>" << m_dateOfBirth.toString("dd.MM.yyyy").toHtmlEscaped().toStdString() << "</td>"
<< std::endl;
out << "<td colspan=\"2\">Bemerkungen</td>" << std::endl;
out << "</tr>" << std::endl;
out << "<tr>" << std::endl;
out << "<td>Untersuchungsdatum</td>" << std::endl;
out << "<td></td>" << std::endl;
out << "<td colspan=\"2\" rowspan=\"2\"></td>" << std::endl;
out << "<td>" << m_dateOfTest.toString("dd.MM.yyyy").toHtmlEscaped().toStdString() << "</td>"
<< std::endl;
out << "<td colspan=\"2\" rowspan=\"2\">"
<< m_remarks.trimmed().toHtmlEscaped().replace("\n", "<br>").toStdString() << "</td>"
<< std::endl;
out << "</tr>" << std::endl;
out << "<tr>" << std::endl;
out << "<td>Alter am Testtag</td>" << std::endl;
out << "<td></td>" << std::endl;
out << "<td>" << getAge().toString() << "</td>" << std::endl;
out << "</tr>" << std::endl;
out << "</table>" << std::endl;

View File

@ -137,8 +137,8 @@ void MainWindow::closeFile()
void MainWindow::print() const
{
std::ofstream htmlfile("print.html");
htmlfile << m_dataModel->toHtml();
//std::ofstream htmlfile("print.html");
//htmlfile << m_dataModel->toHtml();
QPrinter printer;