Bug 157991 - Print scaling not applied when using single column, column wider than page width, with text-wrapping
Summary: Print scaling not applied when using single column, column wider than page wi...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.6.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Print-Range
  Show dependency treegraph
 
Reported: 2023-10-30 20:20 UTC by tmacalp
Modified: 2023-11-08 13:53 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
sample showing non-scaling in print or print preview (11.78 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-10-31 17:44 UTC, crxssi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tmacalp 2023-10-30 20:20:39 UTC
Description:
LO Calc is not applying print scaling when:
* Page Scaling is applied to Page Format
* A sheet only uses one column (A)
* Column A is wider than the page format
* A cell in column A uses text wrapping and contains cells that wraps
Print preview shows that column A is not scaled and is chopped off the right side of the sheet.

Steps to Reproduce:
1 New Spreadsheet

2 Enable shrink print ranges to 1 page
  * Format -> Page Style -> Sheet
  * Scale -> Scaling mode -> Shrink print range(s) on number of pages, number of pages: 1
  * OK

3 Set column width to be wider than page format width
  * Right click header for column A -> "Column Width"
  * 9 inches (or wider than page format width)
  * OK

4 Enable text wrapping on cell
  * Right click A1 -> Format Cells -> Alignment -> Enable "Wrap text automatically"
  * OK

5 Add long text to A1
  * Paste some long text into A1: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sollicitudin, odio et commodo dapibus, mi ex imperdiet lacus, eu tincidunt nisi neque ac mi. Nunc efficitur, nulla a euismod consectetur, odio urna aliquam enim, a pellentesque leo mauris a metus."

6 Print Preview

Actual Results:
Cell A1 is not scaled and extends beyond page margins, cutting off text.

Expected Results:
Cell A1 should be scaled to fit within page margins and all text should be printed.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
If we add some text to column B, column A and B scale correctly.  It also seems to scale properly if insert a new column to the left of column A.

I'm setting the version to the earliest version I have access to, which is LO 4.2.6.2.  But it also affects 7.5.7.1.
Comment 1 m_a_riosv 2023-10-31 17:27:36 UTC
Please better attach a sample file showing the issue.
Comment 2 crxssi 2023-10-31 17:42:49 UTC
I can verify this is a problem.  I am attaching a sample 1 cell spreadsheet.  Open the sheet, then look at print preview.  It is not scaling properly.
Comment 3 crxssi 2023-10-31 17:44:03 UTC
Created attachment 190570 [details]
sample showing non-scaling in print or print preview

Open sheet and look at print preview
Comment 4 m_a_riosv 2023-10-31 22:38:46 UTC
Seems as the cell size is larger than the page width, it is treated as such.

Reducing the number of pages adapts it properly.

Also, scaling as percent works fine.
Comment 5 crxssi 2023-10-31 23:37:56 UTC
(In reply to m.a.riosv from comment #4)
> Seems as the cell size is larger than the page width, it is treated as such.

I am not sure what you mean.  The whole point of "Fit page" is to force it to automatically fit on the page(s) as specified.

When you open the sample document and use Format> Page Style> Sheet> and select either "Fit print range(s) on number of pages" = 1, or "Fit Print range(s) to width/height" = 1/1, it most certainly is not scaling the sheet to fit on the one page.  It is allowing the cell to spill off the page, truncating the right side of the printout into nothingless (the missing text doesn't appear on ANY page).

And yet, if you add any data in the column NEXT to column A (like B1), it will immediately and properly scale the sheet to fit on the page as specified.  The behavior should not change depending on how many cells there are.  There is clearly something broken.

> Reducing the number of pages adapts it properly.

There is only one page in this example.  How does one reduce the number of pages to less than one?

> Also, scaling as percent works fine.

Irrelevant.  The bug is that it is not working with "Fit Print range(s)..."

Additional info: if you have a bunch (perhaps 40) of these cells copied down and set "Fit Print range(s) to width/height" 1/1 it works, but if you set it to 1/9999 it fails.
Comment 6 Heiko Tietze 2023-11-03 14:59:47 UTC
(In reply to crxssi from comment #5)
> (In reply to m.a.riosv from comment #4)
> > Seems as the cell size is larger than the page width, it is treated as such.
> 
> I am not sure what you mean.  The whole point of "Fit page" is to force it
> to automatically fit on the page(s) as specified.

Doesn't it work as best as possible? Is the expectation to decrease the font size until the column fits on the page (and to raise it respectively on narrow content)?
Comment 7 crxssi 2023-11-03 15:16:27 UTC
(In reply to Heiko Tietze from comment #6)
> (In reply to crxssi from comment #5)
> > (In reply to m.a.riosv from comment #4)
> > > Seems as the cell size is larger than the page width, it is treated as such.
> > 
> > I am not sure what you mean.  The whole point of "Fit page" is to force it
> > to automatically fit on the page(s) as specified.
> 
> Doesn't it work as best as possible? Is the expectation to decrease the font
> size until the column fits on the page (and to raise it respectively on
> narrow content)?

Yes, that is exactly what I would expect and how it should work.  If there are two or more columns, that is exactly what it does- it lowers the font size until it fits on the page horizontally and/or vertically (depending on which option you choose).  Why would it not work that way when there is one column?  Why should that be handled differently?

If you ask Calc to fit to page and it doesn't, it isn't "fit to page". It is "fit to page as long as you have more than one column or your single column is manually set to some unknown-to-the-user width that doesn't exceed the page width" :)
Comment 8 Heiko Tietze 2023-11-08 13:53:24 UTC
(In reply to crxssi from comment #7)
> If you ask Calc to fit to page and it doesn't, it isn't "fit to page".
Sounds reasonable. Adding another column to the example works as expected.