diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2024-03-04 15:00:51 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-03-04 17:21:17 +0100 |
commit | 2efe362c99a9fa6e9a71b9b675b025c64b6c7f9d (patch) | |
tree | 5af10096358b460229608a6faea7ea3ecc6a21e2 /sc/source | |
parent | 68f55fc9a1aa8c0f403761e39e7531ae298ea79e (diff) |
tdf#159483 sc HTML copy: handle data-sheets-formula attribute
When a formula cell gets copied from Calc to google docs, only the
formula result was copied, not the formula.
There is a data-sheets-formula attribute on <td> that can describe the
formula we have.
Fix the problem by extending ScHTMLExport::WriteCell() to emit that.
This is more or less the export equivalent of commit
7812adb2ed11a3e08be24d3f2f94d14bfd740c55 (tdf#159483 sc HTML paste:
handle data-sheets-formula attribute, 2024-02-12).
Change-Id: Iab373ce8a028deb6a2874a8c690e928edf5d79f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164363
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/html/htmlexp.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index c2554b7612f1..4413d668b428 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -1172,6 +1172,15 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC } } } + + if (aCell.getType() == CELLTYPE_FORMULA) + { + // If it's a formula, then also emit that, grammar is R1C1 reference style. + OUString aFormula = aCell.getFormula()->GetFormula( + formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); + aStrTD.append(" " OOO_STRING_SVTOOLS_HTML_O_DSformula "=\"" + + HTMLOutFuncs::ConvertStringToHTML(aFormula) + "\""); + } } else { |