sc/source/ui/docshell/impex.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit f5ecfd0754cef194e670d4db0fea8bbe4c6fe2c9
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Fri Feb 16 15:49:17 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Feb 16 18:06:23 2024 +0100

    sc: add a debug env var to control the target of the HTML export
    
    Similar to 9f6b7af1a6f4f5b18dc9f8c8371ba579105665a3 (sc: add a debug env
    var to control the source of the HTML import, 2024-01-18).
    
    Change-Id: Ibe9b2f7316ee634f98a16508e5574c1406b4204a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163488
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 2d3abccefcca..e320861d2930 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2493,8 +2493,17 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
     return rStrm.GetError() == ERRCODE_NONE;
 }
 
-bool ScImportExport::Doc2HTML( SvStream& rStrm, const OUString& rBaseURL )
+bool ScImportExport::Doc2HTML( SvStream& rStream, const OUString& rBaseURL )
 {
+    std::optional<SvFileStream> oStream;
+    char* pEnv = getenv("SC_DEBUG_HTML_COPY_TO");
+    if (pEnv)
+    {
+        OUString aURL;
+        osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(pEnv), 
aURL);
+        oStream.emplace(aURL, StreamMode::WRITE);
+    }
+    SvStream& rStrm = pEnv ? *oStream : rStream;
     // rtl_TextEncoding is ignored in ScExportHTML, read from Load/Save HTML 
options
     ScFormatFilter::Get().ScExportHTML( rStrm, rBaseURL, &rDoc, aRange, 
RTL_TEXTENCODING_DONTKNOW, bAll,
         aStreamPath, aNonConvertibleChars, maFilterOptions );

Reply via email to