Description: When I have a Calc spreadsheet with multiple filled columns (3 columns) without adjustment, if I select one column (column B) and double click between columns header (A and B or C and D) to auto fit column width to content, the column not fit properly. Steps to Reproduce: 1. Create a Calc spreadsheet with 3 filled columns without adjustment to their content; 2. Select one column (column B) and double click between columns header (A and B or C and D) to auto fit column width to content. Actual Results: The column don't auto fit to it content, only selected column fit properly. Expected Results: The column auto fit to it content. Reproducible: Always User Profile Reset: No Additional Info: Version: 7.0.0.2 (x86) Build ID: c01aa64b6c3d89ebe5fe69c28c7adb24eb85249c Threads da CPU: 8; SO: Windows 10.0 Build 19041; Realizador da interface: Skia/Vulkan; VCL: win Locale: pt-BR (pt_BR); Interface: pt-BR Calc: threaded
*** Bug 139482 has been marked as a duplicate of this bug. ***
NEW per duplicate
Possibly this is the consequence of the *intended* behavior, that selection defines the width. The idea is, that you can select (selection is not equal to focusing!) a cell or a cell range, and the auto-fit feature will consider the cells in the selection, ignoring cells outside. Note that when you select column B, and try to auto-fit column A, there is no cells in A that in the selection -> no cells must be taken into account, hence the width resets to a default. Note also, that the discussed feature is broken since 4.1 (bug 148008). Regardless of the bug 148008, I don't know if the behavior discussed here is bad, or is it actually reasonable and logical in the frame of the feature. IMO, it looks logical: a selection is present, and has no cells to consider for this column -> use a default. OTOH, in the same case, "-> use the widest cell" would be also a viable option... Note that, no matter how this should resolve, the other case, when an *empty* cell in A is selected, A should continue to reset to a default.
*IIF* this is decided to be changed, here's a code pointer: ScColumn::GetOptimalColWidth in sc/source/core/data/column2.cxx When an existing selection doesn't cover the column in question, aMarkedSpans stays empty. The change could be to generalize the '"Select" the entire column if no selection exists' code to all cases when aMarkedSpans is empty after the previous check.
(noting that Mike fixed the bug 148008 regression for 7.5.3+ and 7.6.0+.) Copying UX/Design team to decide if this is working as expected, or if something needs to change. I agree that it is surprising that nothing happens when trying to optimize the column width if a selection outside the resized column is active. In my opinion, this feature should only be active if part of the column being resized are selected.
(In reply to Stéphane Guillou (stragu) from comment #5) > nothing happens when trying to optimize > the column width if a selection outside the resized column is active. (or resets to the default width if its width differs)
I think double-click between the column headers should trigger the optimal width function- and behave the same consequently. In fact you can use the command for multiple selections but not double click, neither the selection nor any other column.