Bug 142893 - Issues with row height calculation
Summary: Issues with row height calculation
Status: RESOLVED DUPLICATE of bug 108638
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.0.5.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-16 10:58 UTC by michael
Modified: 2021-06-16 18:15 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description michael 2021-06-16 10:58:06 UTC
Calc has a few issues with row height calculation, which are somewhat interrelated.

To reproduce:

1. Open a blank spreadsheet.
2. Format cells A1:B4 to auto-wrap text.
3. Fill cells B1:B4 with text, about 6 rows per cell.
4. Apply optimum row height if necessary.
5. Zoom in (about 140%).
6. Verify row height, and apply optimum row height again.
7. Zoom back to 100%.
8. Verify row height, and apply optimum row height again.
9. Fill A1 with long text (longer than B1:B4 combined).
10. Merge A1:A4, apply optimum row height if necessary.

Expected behavior:

* Zooming in and out should not affect row height calculation, i.e. steps 6 and 8 should not result in row height changes.
* Editing text should not affect row height changes, unless the cell being edited is the single tallest cell in its row either before or after editing.
* If a merged cell needs to be taller than the sum of its constituent rows, the rows should be enlarged (e.g proportionally).

Actual behavior:

* When zooming in or out, text may suddenly become too long for the cell to accommodate.
* When editing text in a row, even a one-liner next to a cell containing multiple rows (previously set to optimum height), the row may shrink slightly, causing the long text to no longer fit.
* Merged cells are as tall as their constituent rows, never taller, even if their content does not fit.

Additional comments:

* Size calculations should be done in a display-neutral manner; same goes for the actual layout. This is also occasionally an issue with printing: text fits into one row on screen but is wrapped in the printout due to minute differences in layout and text length being close to one full row.
* It looks as if the code has two different routines for row height calculation in different places, with different results. Code deduplication would probably solve that.
* Merged cell height is probably a tricky issue, with multiple possible solutions. If nothing else works, extend the last row of the merged cell so the content fits. Proportionally enlarging cells would give nicer results, but may become difficult if different merged cells span overlapping ranges of rows (say, A1:A2 and B2:B3).
Comment 1 V Stuart Foote 2021-06-16 17:06:26 UTC
Set a default printer, I'd recommend a ghostscript driven virtual printer.

Then from Tools -> Options -> LibreOffice Calc -> General panel, check the 'Use printer metrics for text formatting' checkbox.

That should tame the row height shifts at different zoom scales.

*** This bug has been marked as a duplicate of bug 108638 ***
Comment 2 Jim Avera 2021-06-16 17:53:28 UTC
For me, 'Use printer metrics for text formatting' messes up screen display, causing columns to be too narrow to display all values (some appear as "###").
Comment 3 V Stuart Foote 2021-06-16 18:15:34 UTC
(In reply to Jim Avera from comment #2)
> For me, 'Use printer metrics for text formatting' messes up screen display,
> causing columns to be too narrow to display all values (some appear as
> "###").

Leave 'Use printer metrics for text formatting' enabled.

Reset optimum column widths (Format -> Columns -> Optimal Width..._dialog and check defaults);  and perhaps reapply the default cell style. 

Better?