A sheet is printed at its own width: nothing fits it to paper, and we add a ruler it has no room for
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start with html/document_style.cpp and html/document_element.cpp to understand sheet widths and the ruler, then read html/document.cpp and document_element.hpp for page-layout handling. The issue leaves a design decision between fitting and pagination, and notes that ODS page styles are not parsed; agree on scope before making changes. Done means printed sheets fit or paginate as intended without changing the on-screen view.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
A user reports that a one-page .ods opens and displays correctly, but printed from an Android phone it comes out too wide and is cut off along the right edge; the same file prints correctly from a PC. The frontend half of that report is opendocument-app/OpenDocument.droid#644, which concludes the more correct fix belongs here — this is that half.
What the renderer does today
A sheet is laid out at the width the file states, and at nothing else. translate_sheet writes one <col> per column carrying the document's column width as both width and min-width (html/document_style.cpp:312), and .odr-sheet is table-layout:fixed. The table is therefore exactly as wide as the file says, in the file's own centimetres or inches, whatever it is rendered onto.
Nothing then relates that to paper.
fragment_content_pixels(const Sheet &, const HtmlConfig &)returns nothing — "A sheet reflows; there is no page box to fit" (html/document.cpp:58). Only a text root, a slide and a drawing page get a fitted width.Sheethas nopage_layout()(document_element.hpp:309): the sheet's page style — paper size, orientation, scale / fit-to-pages, print ranges, repeated rows and columns — is neither parsed nor exposed, so even a renderer that wanted to honour it has nothing to read.- The one
@media printblock the output carries pins the zoom back to actual size (html/common.cpp:249), correctly — "paper has its own geometry" — but nothing fits the sheet to that geometry afterwards. No@pagerule is written anywhere, andHtmlConfighas no print-related setting.
And we add width the file does not have. The ruler — the corner/row-number gutter plus the <thead> of column letters (html/document_element.cpp:201-256) — measures 38px, 0.40in ≈ 1.0cm, at the default ruler font, and prints along with everything else. A spreadsheet application prints neither by default. A sheet whose own columns exactly fill A4's text width is therefore about a centimetre too wide as html before any other factor.
Measured
Chrome headless --print-to-pdf on the output of test/data/input/odr-public/ods/file_example_ODS_10.ods (8 columns × 0.889in, table 7.50in including the 0.40in ruler). That path has no print-preview scale control, like the print adapter a WebView hands the Android print framework.
| table width | paper | result |
|---|---|---|
| 7.50in | A4, 20mm margins (content 6.69in) | fits — the browser shrinks it |
| 11.6in (columns widened to 1.4in) | Letter, default margins (content ≈7.7in) | fits, at a shrink that leaves the text barely legible |
| 13.2in (columns 1.6in) | Letter, default margins | cut off: column H is sliced mid-column, its values are absent from the pdf entirely, and the lost columns continue on no further page — one page out |
So what saves the output today is a browser shrink-to-fit heuristic we neither ask for nor control: bounded (it gave up somewhere between 1.5× and 1.7× of the printable width here), silent when it gives up, and different per browser and per print path. Desktop print dialogs expose a scale/fit control and a preview on top of it; the Android print framework offers the user no scaling at all (PrintingManager hands webView.createPrintDocumentAdapter() a default PrintAttributes). That is the reported asymmetry between the phone and the PC.
What a fix has to decide
- Fit, or paginate. Scaling the sheet to the page width is the small fix and matches what the browser is already half-doing, but a wide sheet then prints unreadably small. A spreadsheet application paginates instead, and paginating column-wise means either emitting the sheet in slices or a
@pageplus a transform per slice — html cannot break a table horizontally on its own. - What the file already says. Paper size, orientation, fit-to-pages, print ranges and repeated header rows/columns all live in the ods page style and are the answer to both of the above. None of it is parsed. Doing this properly starts there, and it is also what odt headers/footers (#307) and #174 would want.
- The ruler should not print — a spreadsheet application does not print it, and it is the centimetre a page that has none to spare is losing. The cheapest partial improvement, and independent of the rest.
- Whatever lands must not change the on-screen view, which is what the ruler and the natural width are there for.
- Ngôn ngữ chính
- C++
- Star
- 41
- Fork
- 10
- Merge trung bình
- 12 giờ 4 phút
- Pull request đã merge (30 ngày)
- 297
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của opendocument-app/OpenDocument.core
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
opendocument-app/OpenDocument.core#1211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
opendocument-app/OpenDocument.core#1210 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
opendocument-app/OpenDocument.core#1209 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
opendocument-app/OpenDocument.core#1208 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
opendocument-app/OpenDocument.core#1207 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của opendocument-app/OpenDocument.core
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
FujiNetWIFI/fujinet-firmware#2045 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
(S1 - Need confirmation)
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
CleverRaven/Cataclysm-DDA#89159 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:libnvmpi bug P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
gjrtimmer/jetson-nvmpi#33 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug(wasi_crypto): ArrayOutput::pull reports the wrong all-pulled flagCó thể đã có người làm @Yashbhu đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày