Skip to content

Commit

Permalink
Partial fix for bug 660027
Browse files Browse the repository at this point in the history
Encapsulate table header and body with <thead> and <tbody>
and prevent page-breaks within a <tr>
  • Loading branch information
christopherlam authored and gjanssens committed Aug 16, 2017
1 parent 190a96f commit 2bc106a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/report/report-system/html-fonts.scm
Expand Up @@ -159,6 +159,7 @@
"a { " account-link-font-info " }\n"
"body, p, table, tr, td { text-align: left; vertical-align: top; " text-cell-font-info " }\n"
"tr.alternate-row { background: " alternate-row-color " }\n"
"tr { page-break-inside: avoid !important;}\n"
"th.column-heading-left { text-align: left; " number-header-font-info " }\n"
"th.column-heading-center { text-align: center; " number-header-font-info " }\n"
"th.column-heading-right { text-align: right; " number-header-font-info " }\n"
Expand Down
4 changes: 4 additions & 0 deletions src/report/report-system/html-table.scm
Expand Up @@ -668,6 +668,7 @@
#f (gnc:html-table-col-styles table))

;; render the headers
(push (gnc:html-document-markup-start doc "thead" #t))
(push (gnc:html-document-markup-start doc "tr" #t))
(for-each
(lambda (hdr)
Expand All @@ -685,6 +686,7 @@
colnum))))
ch)
(push (gnc:html-document-markup-end doc "tr"))
(push (gnc:html-document-markup-end doc "thead"))

;; pop the col header style
(gnc:html-document-pop-style doc))))
Expand All @@ -700,6 +702,7 @@
#f)
#f (gnc:html-table-col-styles table))

(push (gnc:html-document-markup-start doc "tbody" #t))
;; now iterate over the rows
(let ((rownum 0) (colnum 0))
(for-each
Expand Down Expand Up @@ -749,6 +752,7 @@
(set! colnum 0)
(set! rownum (+ 1 rownum))))
(reverse (gnc:html-table-data table))))
(push (gnc:html-document-markup-end doc "tbody"))

;; write the table end tag and pop the table style
(push (gnc:html-document-markup-end doc "table"))
Expand Down

0 comments on commit 2bc106a

Please sign in to comment.