diff options
author | Gabriel Masei <gabriel.masei@1and1.ro> | 2024-03-17 10:13:25 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-06 19:39:22 +0200 |
commit | 2feda8ba21acdcf33a9b4ba94742f574c17839bd (patch) | |
tree | 3060f16f398131e08545fe15d909ea3753a800d6 /sc/source/ui/unoobj/filtuno.cxx | |
parent | 2564374efebb5218fbc3c81540fe95557f6119ac (diff) |
tdf#152336 Detect charset and separators for csv files
Change-Id: Ie8451b3d30e390d363d8f9e5ec8bdf47350ca3a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164936
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/unoobj/filtuno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/filtuno.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index fa520e23aeff..b5e9421b5440 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -179,15 +179,25 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() { // ascii import is special... + ScAsciiOptions aInOptions, *pInOptions = nullptr; INetURLObject aURL( aFileName ); // tdf#132421 - don't URL encode filename for the import ASCII dialog title OUString aPrivDatName(aURL.GetLastName(INetURLObject::DecodeMechanism::Unambiguous)); std::unique_ptr<SvStream> pInStream; if ( xInputStream.is() ) + { pInStream = utl::UcbStreamHelper::CreateStream( xInputStream ); + if (aFilterOptions.isEmpty()) + aFilterOptions = "DETECT,34,DETECT,,,,,,,,,,,,"; + SfxObjectShell::DetectCsvFilterOptions(*pInStream, aFilterOptions); + + aInOptions.ReadFromString(aFilterOptions); + pInOptions = &aInOptions; + } + ScopedVclPtr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg(Application::GetFrameWeld(xDialogParent), aPrivDatName, - pInStream.get(), SC_IMPORTFILE)); + pInStream.get(), SC_IMPORTFILE, pInOptions)); if ( pDlg->Execute() == RET_OK ) { ScAsciiOptions aOptions; |