Support table border color and cellpadding in ODF writer

Change-Id: I1d57baa6820ee1322ac461c0db860990ff8f940d
Fixes: QTBUG-67622
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2018-11-08 10:35:22 +01:00
parent e8e8fb5154
commit dbffff0116

View File

@ -886,26 +886,30 @@ void QTextOdfWriter::tableCellStyleElement(QXmlStreamWriter &writer, const int &
if (hasBorder) {
writer.writeAttribute(foNS, QString::fromLatin1("border"),
pixelToPoint(tableFormatTmp.border()) + QLatin1String(" ")
+ borderStyleName(tableFormatTmp.borderStyle())
+ QLatin1String(" #000000")); //!! HARD-CODING color black
+ borderStyleName(tableFormatTmp.borderStyle()) + QLatin1String(" ")
+ tableFormatTmp.borderBrush().color().name(QColor::HexRgb));
}
qreal padding = format.topPadding();
if (padding > 0 && padding == format.bottomPadding()
&& padding == format.leftPadding() && padding == format.rightPadding()) {
qreal topPadding = format.topPadding();
qreal padding = topPadding + tableFormatTmp.cellPadding();
if (padding > 0 && topPadding == format.bottomPadding()
&& topPadding == format.leftPadding() && topPadding == format.rightPadding()) {
writer.writeAttribute(foNS, QString::fromLatin1("padding"), pixelToPoint(padding));
}
else {
if (padding > 0)
writer.writeAttribute(foNS, QString::fromLatin1("padding-top"), pixelToPoint(padding));
if (format.bottomPadding() > 0)
padding = format.bottomPadding() + tableFormatTmp.cellPadding();
if (padding > 0)
writer.writeAttribute(foNS, QString::fromLatin1("padding-bottom"),
pixelToPoint(format.bottomPadding()));
if (format.leftPadding() > 0)
pixelToPoint(padding));
padding = format.leftPadding() + tableFormatTmp.cellPadding();
if (padding > 0)
writer.writeAttribute(foNS, QString::fromLatin1("padding-left"),
pixelToPoint(format.leftPadding()));
if (format.rightPadding() > 0)
pixelToPoint(padding));
padding = format.rightPadding() + tableFormatTmp.cellPadding();
if (padding > 0)
writer.writeAttribute(foNS, QString::fromLatin1("padding-right"),
pixelToPoint(format.rightPadding()));
pixelToPoint(padding));
}
if (format.hasProperty(QTextFormat::TextVerticalAlignment)) {