diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-01-22 15:59:01 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-03-11 12:43:35 +0100 |
commit | dc4a291b900fd4786e9e9e7515c3a8675a8c3467 (patch) | |
tree | c933e6d82f7ef701721fd5cc9d132cd8bdeb9c15 /sc | |
parent | 5f70927f948c4c86887236a0451545ce0ca20ec2 (diff) |
tdf#125440 When inserting TSV, consider quotes as field markers
The problem is that this is "plain text" from the clipboard format,
but actually contains TSV (tab separated values). So treat them accordingly,
so that each value gets its own cell.
Change-Id: I0029e6ace90fc542c3269dd82bb7531654157a69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87194
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 6b475eccba0e..f99a8ce5fff5 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -889,6 +889,8 @@ bool ScImportExport::Text2Doc( SvStream& rStrm ) for( ;; ) { rStrm.ReadUniOrByteStringLine( aLine, rStrm.GetStreamCharSet(), nArbitraryLineLengthLimit ); + // tdf#125440 When inserting tab separated string, consider quotes as field markers + DoubledQuoteMode mode = aLine.indexOf("\t") >= 0 ? DoubledQuoteMode::ESCAPE : DoubledQuoteMode::KEEP_ALL; if( rStrm.eof() ) break; SCCOL nCol = nStartCol; @@ -901,7 +903,7 @@ bool ScImportExport::Text2Doc( SvStream& rStrm ) { // Always look for a pairing quote and ignore separator in between. while (*p && *p == cStr) - q = p = lcl_ScanString( p, aCell, pSeps, cStr, DoubledQuoteMode::KEEP_ALL, bOverflowCell ); + q = p = lcl_ScanString( p, aCell, pSeps, cStr, mode, bOverflowCell ); // All until next separator or quote. while (*p && *p != cSep && *p != cStr) ++p; |