Frame flextable header column labels with an outer border only#274
Frame flextable header column labels with an outer border only#274Melkiades wants to merge 3 commits into
Conversation
border_outer(part = "header") drew a box around the title/study/parameter header block and left an inconsistent missing right border on the last header row. Replace it with hline_top() + hline_bottom() so the header keeps horizontal rules only, matching TLG conventions. Regenerates the theme command snapshot accordingly. Closes #272
Address review: column labels should have an outer border (a single box) with no internal borders between header rows. Clear the inner horizontal header borders and apply border_outer(part = header) instead of the top/bottom rules.
dd89ef4 to
3c7d0f4
Compare
Unit Tests Summary 1 files 257 suites 3m 36s ⏱️ Results for commit 6bcb4ec. ♻️ This comment has been updated with latest results. |
Unit Test Performance DifferenceAdditional test case details
Results for commit f4a3ef1 ♻️ This comment has been updated with latest results. |
Code Coverage SummaryDiff against mainResults for commit: 6bcb4ec Minimum allowed coverage is ♻️ This comment has been updated with latest results |
|
let's wait this a little bit for feature confirmation. |
3c7d0f4 to
fe7418e
Compare
There was a problem hiding this comment.
Pull request overview
This PR aims to adjust theme_gtsummary_roche() so the flextable header no longer has a vertical (left/right) frame, retaining only horizontal rules, per issue #272.
Changes:
- Updates the Roche theme’s flextable header border directives.
- Updates/extends tests that inspect header borders (including a docx XML-based test).
- Regenerates the theme command snapshot and adds a NEWS entry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
R/theme_gtsummary_roche.R |
Changes the flextable header border commands used by the Roche theme. |
tests/testthat/test-theme_gtsummary_roche.R |
Updates expectations around header borders and adds a docx regression test. |
tests/testthat/_snaps/theme_gtsummary_roche.md |
Updates the snapshot of theme-applied flextable commands. |
NEWS.md |
Documents the theme change for the development version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d2dc8c8 to
ab3aa48
Compare
border_inner_h() cleared the internal header borders with a width-0 solid border, but the docx writer still emits a visible single line for a solid border regardless of width. With multi-level headers this drew a rule between the spanner row and the column labels. Switch to fp_border(width = 0, style = none) so the line is suppressed in docx while the outer frame is kept. Regenerates the theme command snapshot accordingly.
ab3aa48 to
6bcb4ec
Compare
| d <- withr::local_tempdir() | ||
| utils::unzip(f, exdir = d) | ||
| xml <- paste(readLines(file.path(d, "word", "document.xml"), warn = FALSE), collapse = "") | ||
| rows <- regmatches(xml, gregexpr("<w:tr\\b.*?</w:tr>", xml))[[1]] |
There was a problem hiding this comment.
I find it odd that the package is using regular expressions for xml checks. It will be much easier with xml2 package and using Xpath to find the right elements and attributes.
What changes are proposed in this pull request?
theme_gtsummary_roche()now frames the flextable column labels with an outer border only, removing the internal borders between header rows and the inconsistent missing right border. (theme_gtsummary_roche() draws a vertical frame around the header #272)border_inner_h(part = "header")clears the rules between header rows, thenborder_outer(part = "header")draws a single box around the column-label block. The inner border usesofficer::fp_border(width = 0, style = "none")so docx does not render a line between a spanning header and the column labels (a width-0 solid border is still written as a visible line). The theme command snapshot is regenerated accordingly.Reference GitHub issue associated with pull request.
closes #272