sc/source/filter/excel/xestream.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+)
New commits: commit 1ecf49085ae34561ddc9ef91ded4764fbe1f0732 Author: Paris Oplopoios <[email protected]> AuthorDate: Wed Nov 9 13:43:46 2022 +0200 Commit: Andras Timar <[email protected]> CommitDate: Tue Jan 10 08:12:41 2023 +0000 Get ScViewData through the current doc shell in headless mode When using --convert-to, ScDocShell::GetViewData() would return nullptr so we now get the ScViewData through an alternative route. Change-Id: Ie71a4a1077b3c63c0aadd394fc0d966e679e8803 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142480 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <[email protected]> (cherry picked from commit 95cb9a01bfacf7d9f03194b0710ca3c249bb62fb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142442 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 315b905560f3..c201af071c21 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -53,6 +53,7 @@ #include <sfx2/app.hxx> #include <docsh.hxx> +#include <tabvwsh.hxx> #include <viewdata.hxx> #include <excdoc.hxx> @@ -1045,6 +1046,16 @@ bool XclExpXmlStream::exportDocument() // Get the viewsettings before processing if( ScDocShell::GetViewData() ) ScDocShell::GetViewData()->WriteExtOptions( mpRoot->GetExtDocOptions() ); + else + { + // Try to get ScViewData through the current ScDocShell + ScTabViewShell* pTabViewShell = pShell->GetBestViewShell( false ); + if ( pTabViewShell ) + { + ScViewData* pViewData = &pTabViewShell->GetViewData(); + pViewData->WriteExtOptions( mpRoot->GetExtDocOptions() ); + } + } OUString const workbook = "xl/workbook.xml"; const char* pWorkbookContentType = nullptr;
