diff options
Diffstat (limited to 'sc/source/filter/html/htmlexp.cxx')
-rw-r--r-- | sc/source/filter/html/htmlexp.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 2a3cb6a4f8ae..a2f14f6eff43 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -87,6 +87,7 @@ #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <rtl/strbuf.hxx> #include <officecfg/Office/Common.hxx> +#include <tools/json_writer.hxx> using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -671,6 +672,20 @@ void ScHTMLExport::WriteBody() } rStrm.WriteChar( '>' ); OUT_LF(); + + // A marker right after <body> can be used, so that data-sheets-* attributes are considered + // at all. This is disabled by default. + OString aMarker; + char* pEnv = getenv("SC_DEBUG_HTML_MARKER"); + if (pEnv) + { + aMarker = pEnv; + } + else if (comphelper::LibreOfficeKit::isActive()) + { + aMarker = "<google-sheets-html-origin/>"_ostr; + } + rStrm.WriteOString(aMarker); } if ( bAll ) @@ -1128,6 +1143,17 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC aStrTD.append(HTMLOutFuncs::CreateTableDataOptionsValNum(bValueData, fVal, nFormat, *pFormatter, &aNonConvertibleChars)); + if (!bValueData) + { + // 2 is text. + tools::JsonWriter aJson; + aJson.put("1", static_cast<sal_Int32>(2)); + aJson.put("2", pDoc->GetString(aPos)); + OUString aJsonString = OUString::fromUtf8(aJson.finishAndGetAsOString()); + aStrTD.append(" " OOO_STRING_SVTOOLS_HTML_O_DSval "=\"" + + HTMLOutFuncs::ConvertStringToHTML(aJsonString) + "\""); + } + TAG_ON(aStrTD.makeStringAndClear()); //write the note for this as the first thing in the tag |