From bbeddfd838a2d37f8bfcaf7b99917cd5b0074f86 Mon Sep 17 00:00:00 2001 From: Tobias Predel Date: Fri, 8 Sep 2023 19:32:37 +0200 Subject: [PATCH] Emit cellcolor and/or textcolor in X(HT)ML export When `cellcolor` or `textcolor` in a cell differs from the one of the parent cell, emit its value. See https://github.com/aardappel/treesheets/issues/502 for more details. --- src/cell.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cell.h b/src/cell.h index 63153afc..65530a7d 100755 --- a/src/cell.h +++ b/src/cell.h @@ -237,12 +237,12 @@ struct Cell { str.Prepend(wxString() << text.stylebits); str.Prepend(L" stylebits=\""); } - if (cellcolor != doc->Background()) { + if (cellcolor != (parent ? parent->cellcolor : doc->Background())) { str.Prepend(L"\""); str.Prepend(wxString() << cellcolor); str.Prepend(L" colorbg=\""); } - if (textcolor != 0x000000) { + if (textcolor != (parent ? parent->textcolor : 0x000000)) { str.Prepend(L"\""); str.Prepend(wxString() << textcolor); str.Prepend(L" colorfg=\""); @@ -260,9 +260,9 @@ struct Cell { if (text.stylebits & STYLE_BOLD) style += L"font-weight: bold;"; if (text.stylebits & STYLE_ITALIC) style += L"font-style: italic;"; if (text.stylebits & STYLE_FIXED) style += L"font-family: monospace;"; - if (cellcolor != doc->Background()) + if (cellcolor != (parent ? parent->cellcolor : doc->Background())) style += wxString::Format(L"background-color: #%06X;", SwapColor(cellcolor)); - if (textcolor != 0x000000) + if (textcolor != (parent ? parent->textcolor : 0x000000)) style += wxString::Format(L"color: #%06X;", SwapColor(textcolor)); str.Prepend(L""); str.Append(L' ', indent);