Avoid adding an empty row in the clipboard data

This part from 3aef8adc9a is undone, because
it adds an empty row in the clipboard data. The whole loop can be rethought
later, if necessary.
This commit is contained in:
mgrojo
2017-11-30 22:48:45 +01:00
parent b1e42d08c6
commit dcc0c32c39

View File

@@ -227,7 +227,7 @@ void ExtendedTableWidget::copy(const bool withHeaders)
QString result;
QString htmlResult = "<html><header><style>br{mso-data-placement:same-cell;}</style></header><body><table>";
int currentRow = 0;
int currentRow = indices.first().row();
const QString fieldSepHtml = "</td><td>";
const QString rowSepHtml = "</td></tr><tr><td>";
@@ -252,10 +252,11 @@ void ExtendedTableWidget::copy(const bool withHeaders)
}
// Table data rows
htmlResult.append("<tr><td>");
for(const QModelIndex& index : indices) {
// Separators
if (index.row() != currentRow) {
// Separators. For first cell, only opening table row tags must be added for the HTML and nothing for the text version.
if (indices.first() == index)
htmlResult.append("<tr><td>");
else if (index.row() != currentRow) {
result.append(rowSepText);
htmlResult.append(rowSepHtml);
} else {