flextable by default will make the tables as wide as possible in word. This function will correct the autofit() feature and make the contents fit.

flextable_word(tab, pg_width = 7, column_width = NULL)

Arguments

tab

a flextable object

pg_width

width (in inches) of the table. Generally 1 inch less than the default word document (8 in.)

column_width

named vector, where the column names are assigned to the desired relative width. If specified, set these column widths before fitting to word document

Value

a formatted flextable

Details

column_width is specified using the following convention:

tab %>%
flextable_word(column_width = c("col1" = 2, "col2" = 3))