Outputting a huxtable
(huxtable
version 5.4.0
) to a docx
seems to ignore the font that has been set via huxtable::set_font()
. On my system I get an output in font "DejaVu Sans".
library(magrittr)
library(huxtable)
ht <- huxtable(column1 = 1:5,
column2 = letters[1:5]) %>%
set_font("arial")
quick_docx(ht, file = "hux.docx", open = FALSE)
As it turns out, transforming the huxtable to a flextable via huxtable::as_flextable()
and then setting the font via flextable::font()
works (flextable
version 0.6.6
).
ht_flex <- ht %>%
as_flextable() %>%
flextable::font(fontname = "arial")
flextable::save_as_docx(ht_flex, path = "hux_flex.docx")
I would, however, prefer if I could get the job done purely with huxtable
. Am I missing something or is this something specific to my system setup?