Skip to content

Conversation

@mstackhouse
Copy link
Collaborator

This PR fixes some nuanced problems with vector simplifications and some problems that surfaced with spanning headers.

Thank you to Rebekah Oster from the Atorus team for figuring out that you can do figures with the current implementation, of which I didn't actually know.

Using clin_group_by():

# Upload packages
library(dplyr)
devtools::load_all()

test <- data.frame(
  BYCOL = c("PARAM 1","PARAM 2","PARAM 3"),
  FIGURE = "~/Downloads/F_14_2_3_C.png"
)

# Create clintable
ct <- clintable(test) %>%

  # Column widths
  clin_col_widths(FIGURE = 1) %>%

  # Format column as image
  flextable::colformat_image(
    j = "FIGURE", width = 10, height = 5
  ) %>%
  flextable::delete_part(part="header") %>%
  # Add group by PARAM
  clin_group_by(group_by = c("BYCOL")) 

And another finding of Rebekah's - pagination actually just works fine if you size the image properly:

# Upload packages
library(dplyr)
devtools::load_all()

test <- data.frame(
  BYCOL = c("PARAM 1","PARAM 2","PARAM 3"),
  FIGURE = "./F_14_2_3_C.png"
)

# Create clintable
ct <- clintable(test) %>%

  # Column widths
  clin_col_widths(FIGURE = 1) %>%

  # Format column as image
  flextable::colformat_image(
    j = "FIGURE", width = 10, height = 5
  ) %>%
  # Remove the header
  flextable::delete_part("header") %>%
  # Add group by PARAM
  clin_group_by(group_by = c("BYCOL")) 


# Save the DOCX file
write_clindoc(ct, "./test.docx")

@mstackhouse mstackhouse marked this pull request as draft December 23, 2025 18:50
@mstackhouse mstackhouse marked this pull request as ready for review January 8, 2026 19:52
@mstackhouse mstackhouse merged commit 9f0ed20 into main Jan 8, 2026
10 checks passed
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.

2 participants