Skip to content

Frame flextable header column labels with an outer border only#274

Open
Melkiades wants to merge 3 commits into
mainfrom
fix-header-frame-borders
Open

Frame flextable header column labels with an outer border only#274
Melkiades wants to merge 3 commits into
mainfrom
fix-header-frame-borders

Conversation

@Melkiades

@Melkiades Melkiades commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

border_inner_h(part = "header") clears the rules between header rows, then border_outer(part = "header") draws a single box around the column-label block. The inner border uses officer::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

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
Comment thread R/theme_gtsummary_roche.R Outdated
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.
@Melkiades Melkiades force-pushed the fix-header-frame-borders branch from dd89ef4 to 3c7d0f4 Compare June 21, 2026 11:21
@Melkiades Melkiades marked this pull request as ready for review June 21, 2026 11:27
@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Unit Tests Summary

  1 files  257 suites   3m 36s ⏱️
257 tests 257 ✅ 0 💤 0 ❌
754 runs  754 ✅ 0 💤 0 ❌

Results for commit 6bcb4ec.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Unit Test Performance Difference

Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
annotate_gg_pkc 💔 $0.89$ $+1.17$ annotate_pkc_df_warns_when_given_a_standard_ggplot_object
gg_km 💚 $1.07$ $-1.06$ gg_km_works_and_handles_annotations_correctly
gg_pkc_lineplot 💔 $0.25$ $+1.10$ gg_pkc_lineplot_catches_invalid_combinations_and_missing_inputs
tbl_baseline_chg 💔 $31.00$ $+1.93$ tbl_baseline_chg_works
tbl_hierarchical_incidence_rate 💔 $4.31$ $+1.53$ tbl_hierarchical_incidence_rate_runs_with_minimum_arguments
tbl_hierarchical_rate_by_grade 💚 $3.41$ $-3.27$ tbl_hierarchical_rate_by_grade_works
tbl_rmpt 💔 $15.65$ $+1.67$ tbl_rmpt_works_with_default_parameters_Example_1_
tbl_roche_subgroups 💔 $23.60$ $+1.66$ tbl_roche_subgroups_time_to_event_NULL_works
tbl_roche_summary 💔 $3.47$ $+3.97$ tbl_roche_summary_works
tbl_shift 💚 $5.85$ $-4.59$ tbl_shift_strata_location_
tbl_with_pools 💔 $12.93$ $+3.38$ tbl_with_pools_validates_inputs_correctly
theme_gtsummary_roche 👶 $+0.00$ theme_draws_no_internal_horizontal_line_between_spanner_and_column_labels_in_docx
theme_gtsummary_roche 💔 $5.32$ $+2.00$ theme_gtsummary_roche_works

Results for commit f4a3ef1

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

badge

Code Coverage Summary

Filename                                 Stmts    Miss  Cover    Missing
-------------------------------------  -------  ------  -------  ------------------------------------------------------------------------------------------------
R/add_blank_rows.R                          63       0  100.00%
R/add_difference_row.R                     101       0  100.00%
R/add_forest_utils.R                        97      10  89.69%   76-79, 94-100
R/add_forest.R                             139       0  100.00%
R/add_hierarchical_count_row.R              33       0  100.00%
R/adjust_stat_columns_wrap.R                29       1  96.55%   59
R/annotate_gg_km.R                         135       0  100.00%
R/annotate_gg_pkc.R                         92       0  100.00%
R/annotate_gg.R                             81       0  100.00%
R/ard_tabulate_abnormal_by_baseline.R       65       0  100.00%
R/crane-package.R                            2       2  0.00%    26-27
R/deprecated.R                              21      21  0.00%    18-54
R/df_add_poolings.R                         41       0  100.00%
R/get_cox_pairwise_df.R                    163       0  100.00%
R/gg_km_utils.R                             35      14  60.00%   20-37
R/gg_km.R                                  143      37  74.13%   55-58, 75, 102, 176-181, 184-187, 197-199, 204-205, 239-241, 248-251, 255, 266-270, 283, 285-287
R/gg_lineplot.R                             94       0  100.00%
R/gg_mmrm_lineplot.R                       102       1  99.02%   106
R/gg_pkc_lineplot.R                         98       0  100.00%
R/gg_utils.R                               221       0  100.00%
R/label_roche.R                             72       0  100.00%
R/modify_header_rm_md.R                     18       2  88.89%   35-36
R/modify_zero_recode.R                      20       1  95.00%   64
R/reverse_difference_ci.R                   33       0  100.00%
R/tbl_baseline_chg.R                       188       0  100.00%
R/tbl_coxph.R                               90       1  98.89%   229
R/tbl_hierarchical_incidence_rate.R        291       4  98.63%   430-433
R/tbl_hierarchical_rate_and_count.R        339      13  96.17%   343, 425, 446-456
R/tbl_hierarchical_rate_by_grade.R         317       3  99.05%   169-171
R/tbl_listing.R                             35       0  100.00%
R/tbl_mmrm.R                               254       1  99.61%   393
R/tbl_null_report.R                          9       0  100.00%
R/tbl_rmpt.R                               157      12  92.36%   299-304, 316-321
R/tbl_roche_subgroups.R                    155       0  100.00%
R/tbl_roche_summary.R                       64       0  100.00%
R/tbl_shift.R                              116       0  100.00%
R/tbl_survfit_quantiles.R                  154       0  100.00%
R/tbl_survfit_times.R                       92       0  100.00%
R/tbl_with_pools.R                          64       0  100.00%
R/theme_gtsummary_roche.R                   87       1  98.85%   61
R/utils.R                                   42       0  100.00%
TOTAL                                     4352     124  97.15%

Diff against main

Filename                     Stmts    Miss  Cover
-------------------------  -------  ------  -------
R/theme_gtsummary_roche.R       +3       0  +0.04%
TOTAL                           +3       0  +0.00%

Results for commit: 6bcb4ec

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@shajoezhu

Copy link
Copy Markdown
Contributor

let's wait this a little bit for feature confirmation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread R/theme_gtsummary_roche.R
Comment thread R/theme_gtsummary_roche.R Outdated
Comment thread tests/testthat/test-theme_gtsummary_roche.R
Comment thread tests/testthat/test-theme_gtsummary_roche.R
Comment thread tests/testthat/_snaps/theme_gtsummary_roche.md
Comment thread NEWS.md
Copilot AI requested a review from shajoezhu June 23, 2026 17:13
@Melkiades Melkiades force-pushed the fix-header-frame-borders branch from d2dc8c8 to ab3aa48 Compare June 24, 2026 10:19
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.
@Melkiades Melkiades force-pushed the fix-header-frame-borders branch from ab3aa48 to 6bcb4ec Compare June 24, 2026 10:25
@Melkiades Melkiades changed the title Remove vertical header frame in theme_gtsummary_roche Frame flextable header column labels with an outer border only Jun 24, 2026
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]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

theme_gtsummary_roche() draws a vertical frame around the header

4 participants