Skip to content

Commit

Permalink
update(add_theme): expand upon theme for flextables
Browse files Browse the repository at this point in the history
  • Loading branch information
Schiano-NOAA committed Dec 18, 2024
1 parent d349736 commit c2c9f9b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions R/add_theme.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,23 @@
add_theme <- function(x) {
# this is bad coding practice, but what I have for now
if (class(x)[1] == "flextable") {
FitFlextableToPage <- function(ft, pgwidth = 6){

ft_out <- ft |> flextable::autofit()

ft_out <- flextable::width(ft_out, width = dim(ft_out)$widths*pgwidth /(flextable::flextable_dim(ft_out)$widths))
return(ft_out)
}
theme_obj <- x |>
flextable::merge_h(i = 1, part = "header") |>
flextable::align(part = "header", align = "center") |>
# flextable::font(fontname = "cambria",
# flextable::font(fontname = "arial narrow",
# part = "all") |>
flextable::add_header_lines(top = FALSE)
flextable::bold(part = "header") |>
flextable::add_header_lines(top = FALSE) |>
flextable::align(align = "center", part = "body") |>
flextable::autofit()
# FitFlextableToPage()
} else if (class(x)[1] == "gt_tbl") {
theme_obj <- x
# gt object
Expand Down

0 comments on commit c2c9f9b

Please sign in to comment.