Harmonia print: fit wide tables to the page instead of clipping - #6974
Open
NicoleNG18 wants to merge 1 commit into
Open
Harmonia print: fit wide tables to the page instead of clipping#6974NicoleNG18 wants to merge 1 commit into
NicoleNG18 wants to merge 1 commit into
Conversation
The list/master/report Print buttons build an HTML document and call
window.print(). The stylesheet used `table{width:100%}` with the default
auto table-layout, so a wide table (e.g. Sales Invoices, 17 columns) grew
past the portrait page width and the browser clipped the overflow at the
right edge.
Mirror the server-side FOP path (XslFoRenderer): `table-layout:fixed`
forces the table to the page width, and the font is scaled down by column
count with the same formula, `max(6, 10 - max(0, columns - 3))`. Cell
padding drops to 2pt and long unbreakable tokens (ids, IBANs) wrap inside
the fixed cell, so nothing overflows in portrait.
Fixed in all three copies of the print stylesheet: the shared
basePage.printRows (list/master/manage/my/partner) and the two report
prints (report-file, report table view).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6973
Problem
The list/master/report Print buttons build an HTML document and call
window.print(). The stylesheet usedtable{width:100%}with the browser's default auto table-layout, wherewidth:100%is only a minimum: the browser grows columns to fit content, and when the summed content width exceeds the page, the table overflows and the browser clips everything past the right edge. A wide entity like Sales Invoices (17 columns) loses roughly its right third. Confirmed from the produced PDF's metadata (MediaBox 595x842,Producer: Skia/PDF) — it is Chrome's own portrait print, not the server-side FOP path.Fix — mirror the server-side FOP renderer
No
@page/landscape trick: the server-sideXslFoRendererprints portrait too and solves the identical "wide printed table" problem purely with fixed layout + font scaling. The browser print now does the same:table-layout:fixed; width:100%— the actual fix. Forces the table to exactly the page width so it cannot overflow; over-long content wraps into taller rows instead of being clipped.XslFoRenderer.java(Math.max(6, 10 - Math.max(0, columns - 3))), so a wide table shrinks to stay compact (floors at 6pt).padding:2ptcells (matching FOP) andoverflow-wrap:anywhere; word-break:break-wordso space-less tokens (ids, IBANs likeBG12CODBEXTEXT23) wrap inside their fixed cell.Scope
Fixed in all three copies of the print stylesheet:
application-core/.../pages/basePage.js→printRows— the shared helper behindprintList()on the list / master / manage / my / partner views. Becauseapplication-coreis served once (not copied per project), this fixes every already-generated app after a rebuild, no regeneration needed.template-application-ui-harmonia-java/.../report-file/report.js.template→ standalone report print.template-application-ui-harmonia-java/.../report/table-page.js.template→ report table-view print.The chart print (
chart-page.js) prints an image, not a table, so it is unaffected. No other copies of the pattern exist (verified).Notes
.templateonly — no Java changed, so no formatter/javadoc impact.IntentEmissionCoverageIT'sprintRows(...)/printList()call-site assertions are preserved.🤖 Generated with Claude Code