Bug 46733 - Deleting columns in a table can delete several columns if any cells in that column are merged with other cells
Summary: Deleting columns in a table can delete several columns if any cells in that c...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: high major
Assignee: Justin L
URL:
Whiteboard: target:7.5.0 inReleaseNotes:7.5
Keywords:
: 48704 96171 101091 118111 118997 124304 138602 (view as bug list)
Depends on:
Blocks: Writer-Tables
  Show dependency treegraph
 
Reported: 2012-02-28 10:13 UTC by uls6502
Modified: 2022-12-04 14:53 UTC (History)
15 users (show)

See Also:
Crash report or crash signature:


Attachments
A demonstration of the intended, and actual, behavior. (14.33 KB, image/png)
2012-02-28 10:13 UTC, uls6502
Details
Table example (19.53 KB, application/vnd.oasis.opendocument.text)
2012-09-24 06:25 UTC, vanyasmart
Details
Test file (12.32 KB, application/vnd.oasis.opendocument.text)
2016-10-19 01:06 UTC, Steve Edmonds
Details
46733_columnDeleteScenarios.odt: extensive testing example (28.99 KB, application/vnd.oasis.opendocument.text)
2022-09-22 13:39 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description uls6502 2012-02-28 10:13:25 UTC
Created attachment 57775 [details]
A demonstration of the intended, and actual, behavior.

Steps to reproduce:

1) Create a table.

2) Merge some of the cells together so that the merged area is more than one column wide.

3) Select a different row in one of such columns.

4) Try to delete this column.

Intended behavior:

The only column deleted is the one actually chosen, like in LibreOffice Calc. The merged cell is intact, only combining one column less.
The only way to delete the merged cell is to have the merged cell itself selected(alternately: or the column the merged cell is originally from).

Actual behavior:

All the columns the merged cell combines are deleted, even if the selected cell is in a different row.

Tested on two different installations of LibreOffice 3.5.0 on Debian Squeeze amd64 and Ubuntu 10.04 LTS amd64.
Comment 1 Jose Manuel 2012-04-20 12:30:20 UTC
[Reproducible] with "LibreOffice 3.3.4 - Ubuntu 11.04 (32bit) Spanish UI"
Comment 2 sasha.libreoffice 2012-05-24 05:35:15 UTC
reproduced also in 3.5.2 on Windows 7 32 bit
Changing version to 3.3.4 as most early reproducible, due to comment 2
Comment 3 vanyasmart 2012-09-24 06:25:20 UTC
Created attachment 67608 [details]
Table example

Now I've reproduced this bug in LibreOffice 3.5.4.2 on Ubuntu 12.04 x64 and LibreOffice 3.6.1.2 on Archlinux x64.
Comment 4 vanyasmart 2012-09-24 07:26:01 UTC
*** Bug 48704 has been marked as a duplicate of this bug. ***
Comment 5 Chris Peñalver 2012-09-24 15:10:42 UTC
Changing Version: 3.3.3 due to downstream report https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/462564 .
Comment 6 QA Administrators 2015-04-01 14:39:57 UTC Comment hidden (obsolete)
Comment 7 Mike Kaganski 2015-04-02 01:07:41 UTC
Still REPRODUCIBLE with Version: 4.4.2.2
Build ID: c4c7d32d0d49397cad38d62472b0bc8acff48dd6
Locale: ru_RU
Comment 8 Emersson Augusto Suarez Ortiz 2015-08-26 16:01:38 UTC
Hello to everybody. After read all the comments in this line, I have to inform than the bug still exist and It is not the only one problem, if in the design of the table, you merge all the cells of two column and finally two columns become in one column and you have to delete other column, this disapper too and only remind the columns than never has been merged at all.
The table need to handle the cells individually too, if you want to enlarge or short any single cell, you can't do it.
I've tested in LibreOffice 5.0.0.5 in Win 8.1 and Ubuntu 14.04 64 bits both.
Comment 9 Björn Michaelsen 2015-08-31 10:46:24 UTC
@qfsuarezo@yahoo.es: Please dont change version field if you dont know what it means (see also comment 6).

Setting version to 3.3.3 as it is the earliest affected (see comment 5).
Comment 10 Buovjaga 2015-12-01 10:14:13 UTC
*** Bug 96171 has been marked as a duplicate of this bug. ***
Comment 11 Todd 2015-12-01 10:27:01 UTC
5.0.3.2

I noticed that if you try to delete a column that runs through a row that has been merged, that the whole table gets deleted.

Any sign of our intrepid heroes working on this?
Comment 12 Todd 2016-01-07 05:35:26 UTC Comment hidden (no-value)
Comment 13 Steve Edmonds 2016-10-19 01:04:27 UTC
Also present in 5.2.2.2.0.
Test case added where deleting middle column deletes table.

Work around, split spanning row to match columns, delete column, merge cells in row to span.
Comment 14 Steve Edmonds 2016-10-19 01:06:45 UTC
Created attachment 128063 [details]
Test file

Deleting middle column deletes table.
Comment 15 Jon Gerdes 2016-12-05 18:52:04 UTC
Bug present in 5.2.3.3
Comment 16 Todd 2016-12-22 01:23:27 UTC Comment hidden (no-value)
Comment 17 Todd 2018-02-03 08:24:01 UTC
still an issue in 6.0
Comment 18 Xisco Faulí 2018-06-11 14:18:06 UTC
*** Bug 118111 has been marked as a duplicate of this bug. ***
Comment 19 Telesto 2018-07-30 11:41:02 UTC
*** Bug 118997 has been marked as a duplicate of this bug. ***
Comment 20 Zineta 2018-07-30 13:30:00 UTC
Reproducible with  6.2.0.0.alpha0+

it seems issue inhereted from OOo
Comment 21 Buovjaga 2019-04-19 15:58:37 UTC
*** Bug 124304 has been marked as a duplicate of this bug. ***
Comment 22 Buovjaga 2019-04-19 16:06:47 UTC
*** Bug 101091 has been marked as a duplicate of this bug. ***
Comment 23 Justin L 2020-10-08 18:40:33 UTC
There is some good discussion in the linked OOo bug report on this.
Paraphrasing fyva...
> For tables with merged cells, there are no columns or rows, there are only
> cells. When you select a few cells and click "delete row" or "delete column",
> you can't delete neither a row nor a column (there are no rows, no columns),
> you can either delete the whole table or merge the cells with right, left,
> upper or lower cells, by your choice, because each cell have a lot of adjacent
> cells. This gets really complicated.
Comment 24 Aron Budea 2020-10-19 00:15:57 UTC
(In reply to Justin L from comment #23)
> > cells. This gets really complicated.
What if we didn't bother with the complicated cases, only with the simple, well-structured ones? That's what users seem to care about, anyway. If someone's designing their floor tiles with Writer tables, deleting rows/columns is likely not part of their workflow ;).
Comment 25 Justin L 2020-10-19 06:54:02 UTC
(In reply to Aron Budea from comment #24)
> What if we didn't bother with the complicated cases

We already don't bother with the complicated case, that is why we have this bug report. This bug is complicated because it contains merged cells.
Comment 26 Mike Kaganski 2020-12-01 15:37:25 UTC
*** Bug 138602 has been marked as a duplicate of this bug. ***
Comment 27 Christian Lehmann 2021-04-17 07:21:51 UTC
The case is even more serious, since the attempt to only delete a column can delete the entire table:

The table has 3 columns and three rows.
I merge the cells of row #3.
In column 3, I select the cells in row #1 and row #2.
From the icons menus, I select Delete selected columns.
Result: My table is deleted.
Expected: The selected columns should be deleted, i.e. merged into a neighboring column.

Thus, after nine years, the original report by uls6502 can be confirmed 100%, although this is a rather serious bug.
Comment 28 BogdanB 2021-08-23 07:30:31 UTC
Also in
Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 5b025285b3528910a4360899abb2bbbaadc72c97
CPU threads: 4; OS: Linux 5.11; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 29 zhoussneu 2021-10-17 19:33:33 UTC
Replicated the Report
I installed Writer in my computer which is Windows 10.0.18363, x64-based PC. 
Follow the steps, I could reproduce the issue. 
Just step 3 and 4, I modify a bit with : 
3) Select a cell of a different row in one of these columns
4) right click, and select "delete" --"columns"
Comment 30 Justin L 2022-09-22 13:39:09 UTC
Created attachment 182624 [details]
46733_columnDeleteScenarios.odt: extensive testing example

The problem is that we do a "select column" twice.
The first time is sw/source/core/frmedt/fetab.cxx's SwFEShell::DeleteCol
    GetTableSel( *this, aBoxes, SwTableSearchType::Col );

and the second is SwTable::ExpandColumnSelection
Comment 31 Justin L 2022-09-23 13:47:16 UTC
Proposed basic fix at http://gerrit.libreoffice.org/c/core/+/140455
Comment 32 Commit Notification 2022-09-23 14:06:28 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#46733 sw: don't double-select column during deleteCol

It will be available in 7.5.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 33 Justin L 2022-10-01 01:45:04 UTC Comment hidden (bad_url, no-value)
Comment 34 Timur 2022-10-03 10:30:07 UTC
Thanks Justin for this one, OO reported in 2003!

attachment 182624 [details] is a nice sample, covering more than what was reported. Not sure that all really should be implemented. 

Here are the results of checking duplicates, they are good except attachment 142655 [details] from bug 118111 doesn't have a desired behavior, removing a column from 4 column table gives 2 columns instead of 3, like before the fix. Please comment if under enhancement, or bug should be reopened. 

(attachment 126378 [details] from bug 101091 has an unrelated weird behavior, I'll comment there)

This is significant, it should go to https://wiki.documentfoundation.org/ReleaseNotes/7.5.
Comment 35 Timur 2022-10-03 10:34:14 UTC
(In reply to Timur from comment #34)
> Here are the results of checking duplicates, they are good except attachment
> 142655 [details] from bug 118111 doesn't have a desired behavior, removing a
> column from 4 column table gives 2 columns instead of 3, like before the
> fix. Please comment if under enhancement, or bug should be reopened. 

Nah, it is good, I don't know how I tested.
Comment 36 Justin L 2022-10-05 02:06:08 UTC
(In reply to Justin L from comment #33)
Proposed enhancement (that I am abandoning) at
https://gerrit.libreoffice.org/c/core/+/140812
    sw column: delete matching non-title single-cell row