Bug 129701 - Skip empty cells option does not work for the last column in Calc Text Import dialog
Summary: Skip empty cells option does not work for the last column in Calc Text Import...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.1.0.3 release
Hardware: All All
: medium normal
Assignee: Laurent Balland
URL:
Whiteboard: target:24.8.0 target:24.2.2 target:7....
Keywords: implementationError
: 129699 129752 158297 (view as bug list)
Depends on:
Blocks: Paste CSV-Import
  Show dependency treegraph
 
Reported: 2019-12-30 14:36 UTC by NISZ LibreOffice Team
Modified: 2024-04-24 09:11 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Calc (9.88 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-12-30 14:36 UTC, NISZ LibreOffice Team
Details
The Text Import dialog before pasting (44.44 KB, image/png)
2019-12-30 14:37 UTC, NISZ LibreOffice Team
Details
The file after pasting with A3 not becoming empty (59.54 KB, image/png)
2019-12-30 14:38 UTC, NISZ LibreOffice Team
Details
step to reproduce with an empty cell at the end of a source row (15.55 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-10-13 14:15 UTC, MSessa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2019-12-30 14:36:23 UTC
Description:
When using the Unformatted text paste option in Calc the Skip empty cells option does not seem to make a difference whether its enabled or not

Steps to Reproduce:
1.	Open attachment # from bug # (ide jön az előző bugból a melléklet és a bug száma)
2.	Copy the range B1:B4 and paste it while standing in A1 using the Paste button -> Unformatted text option
3.	The Skip empty cells option in the Text Import dialog is turned on by default. Its tooltip says the sources empty cells should not overwrite the target when enabled.
4.	Try pasting again with Skip empty cells turned off.


Actual Results:
Whether Skip empty cells is enabled or not, the empty cell in B3 does not overwrite the content in A3.

Expected Results:
When Skip empty cells is disabled the content in A3 should be cleared.


Reproducible: Always


User Profile Reset: No



Additional Info:
LibreOffice details:
Verzió: 6.4.0.0.beta1 (x86)
Build az.: 4d7e5b0c40ed843384704eca3ce21981d4e98920
CPU szálak: 4; OS: Windows 6.3 Build 9600; Felületmegjelenítés: alapértelmezett; VCL: win; 
Területi beállítások: hu-HU (hu_HU); Felület nyelve: hu-HU
Calc: CL
Comment 1 NISZ LibreOffice Team 2019-12-30 14:36:58 UTC
Created attachment 156851 [details]
Example file from Calc
Comment 2 NISZ LibreOffice Team 2019-12-30 14:37:47 UTC
Created attachment 156852 [details]
The Text Import dialog before pasting
Comment 3 NISZ LibreOffice Team 2019-12-30 14:38:16 UTC
Created attachment 156853 [details]
The file after pasting with A3 not becoming empty
Comment 4 NISZ LibreOffice Team 2019-12-30 14:38:59 UTC
Bibisected using bibisect-win32-6.1 to: 
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=3bd4957191f12457c17404645bab0794639c95f8

author	Laurent BP <laurent.balland-poirier@laposte.net>	2017-12-17 17:14:55 +0100
committer	Eike Rathke <erack@redhat.com>	2017-12-21 23:16:23 +0100

tdf#113979 Add option to Skip empty cells
Comment 5 m_a_riosv 2019-12-31 07:55:23 UTC
*** Bug 129699 has been marked as a duplicate of this bug. ***
Comment 6 m_a_riosv 2019-12-31 07:56:04 UTC
Repro.
Version: 6.5.0.0.alpha0+ (x64)
Build ID: 42a1a1c6b91907f81e15066ffab219411f18c4db
CPU threads: 4; OS: Windows 10.0 Build 19041; UI render: GL; VCL: win; 
Locale: es-ES (es_ES); UI-Language: en-US Calc: CL
Comment 7 NISZ LibreOffice Team 2020-01-03 07:46:55 UTC
*** Bug 129752 has been marked as a duplicate of this bug. ***
Comment 8 Laurent Balland 2020-01-06 20:11:40 UTC
I do reproduce.
I can also paste with and without skipping in the same time.
1. Copy data:
a;b;c
d;;
g;h;i
2. Paste Unformatted text without option "Skip empty cell" (with semi colon as separator)

Actual behavior:
Cell below "b" is correctly empty (it was erased)
Cell below "c" is skipped and its content is preserved

Expected behavior:
Cells below "b" and "c" should be erased.
Comment 9 Laurent Balland 2020-01-06 20:28:06 UTC
The bug seems older, as for versions previous 6.1 there was no option, and behavior was the same as without checking "Skip empty cells".
I reproduce with Version: 6.0.2.1 (x64)
Build ID: f7f06a8f319e4b62f9bc5095aa112a65d2f3ac89
CPU threads: 2; OS: Windows 6.1; UI render: default; 
Locale: fr-FR (fr_FR); Calc: CL
till version 5.3
In Version: 5.2.7.2 (x64)
Build ID: 2b7f1e640c46ceb28adf43ee075a6e8b8439ed10
Threads CPU : 2; Version de l'OS :Windows 6.1; UI Render : par défaut; 
Locale : fr-FR (fr_FR); Calc: CL
the behavior is similar as if "Skip empty" option is on.
Comment 10 MSessa 2020-10-13 10:14:11 UTC
I do reproduce on:
Version: 6.4.6.2 (x64)
Build ID: 0ce51a4fd21bff07a5c061082cc82c5ed232f115
CPU threads: 8; OS: Windows 10.0 Build 17763; UI render: default; VCL: win; 
Locale: it-IT (it_IT); UI-Language: en-US
Calc: threaded

I had a similar issue in production, so I tried to isolate the problem.
In my experience, the paste unformatted text command works properly when the "skip empty cells" is selected.
On the other side, when the "skip empty cells" is NOT selected, the bug arises only when the source range contains an empty value at the END of a row. Such empty value at the end of the source row does not overwrite the corresponding destination cell in CALC.

. Initial CALC destination range (the one to overwrite)
a | B
c | d

. Source comma-separated range
1,
3,4

Actual result of paste special unformatted text w/o "skip empty cells"
1 | b
3 | 4

Expected result:
1 |
3 | 4

I think that the steps to reproduce initially provided by NISZ LibreOffice Team could fit in this new explanation because the empty cell B3 in the source column-range B1:B4 might be considered as an empty cell at the end of the row 3.
Comment 11 MSessa 2020-10-13 14:15:46 UTC
Created attachment 166348 [details]
step to reproduce with an empty cell at the end of a source row

step to reproduce with an empty cell at the end of a source row
Comment 12 QA Administrators 2022-10-14 03:33:03 UTC Comment hidden (noise)
Comment 13 MSessa 2022-12-01 19:53:06 UTC
The bug is still present in the following version:
Version: 7.4.3.2 (x64) / LibreOffice Community
Build ID: 1048a8393ae2eeec98dff31b5c133c5f1d08b890
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: it-IT (it_IT); UI: it-IT
Calc: threaded
Comment 14 Laurent Balland 2023-12-05 17:30:54 UTC
Bug reproduced with Version: 7.6.3.1 (X86_64) / LibreOffice Community
Build ID: c4af5b1259bceea6e979e6fe2435dbee7a5a87c2
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: CL threaded

The unchecked option does not work only in the *last column*
Pasting
x1,,
,x2,
,,x3

on
A1,B1,C1
A2,B2,C2
A3,B3,C3

if skip empty cells is unchecked, results in
x1,,C1
,x2,C2
,,x3
Comment 15 Laurent Balland 2023-12-05 19:48:57 UTC
*** Bug 158297 has been marked as a duplicate of this bug. ***
Comment 16 ady 2023-12-05 19:58:56 UTC
(In reply to Laurent Balland from comment #15)
> *** Bug 158297 has been marked as a duplicate of this bug. ***

FWIW, from bug 158297, the behavior is seen since LO 5.3.0.3, but different in LO 5.2. The reasons might be different in LO 5.3 and in 5.4 in comparison to LO 6.1 (the Version field ATM in this bug 129701).
Comment 17 ady 2023-12-05 20:21:29 UTC
This bug should have a higher priority IMO. The user has no clue nor way to know that the resulting data is incorrect, which is the same as to say that there is DATA LOSS!

I am tempted to add dataLoss to the Keywords field of this report.
Comment 18 Laurent Balland 2023-12-17 16:07:54 UTC
The bug occurs only with columns separated by separators and NOT with fixed width.

If I correctly understood:
In bool ScImportExport::ExtText2Doc( SvStream& rStrm ) [1], the while loop for the columns [2] ends when there is nothing to paste, even if it is the last column, so the last empty column is not treated if it is empty. And if user pastes only 1 column, empty cells are not treated.


[1] https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/impex.cxx?r=2b4094195&fi=ExtText2Doc#ExtText2Doc
[2] https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/impex.cxx?r=2b4094195&fi=ExtText2Doc#1685
Comment 19 Commit Notification 2024-02-17 07:59:50 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e66ffda7c7f1e78dbca082ff7549ded121dc7356

tdf#129701 Skip empty cell: treat last column

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Commit Notification 2024-03-07 11:00:32 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/60e0ebe633b1dee8bb2a66b9d133f5303749d8d5

tdf#129701 Skip empty cell: treat last column

It will be available in 24.2.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Commit Notification 2024-04-17 11:06:54 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/47187acee758680cda8086b6e295ef7beea3491b

tdf#129701 Follow-up of previous change

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 22 Commit Notification 2024-04-17 17:25:36 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/ed0165f6cbd1f3f9e47be26fe5d60c29eb946030

tdf#129701 Skip empty cell: treat last column

It will be available in 7.6.7.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Commit Notification 2024-04-18 12:44:32 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/637312e2aa682ca11543a421a8de0bbbe72bf86b

tdf#129701 Follow-up of previous change

It will be available in 24.2.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 24 Commit Notification 2024-04-23 08:11:28 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "libreoffice-24-2-3":

https://git.libreoffice.org/core/commit/1d00b945c25c5b9df6553c0c89ef63749ac0a419

tdf#129701 Follow-up of previous change

It will be available in 24.2.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.