Learn R Programming

flextable (version 0.10.0)

fit_to_width: Constrain table width by shrinking font size

Description

Decrease font size incrementally until the table fits within max_width.

To constrain width by wrapping text instead, see fit_columns(). To size columns to their content without a width constraint, see autofit().

Usage

fit_to_width(x, max_width, inc = 1L, max_iter = 20, unit = "in")

Arguments

x

a 'flextable' object, see flextable-package to learn how to create 'flextable' object.

max_width

maximum width to fit in inches

inc

the font size decrease for each step

max_iter

maximum iterations

unit

unit for max_width, one of "in", "cm", "mm".

See Also

Other functions for flextable size management: autofit(), dim.flextable(), dim_pretty(), fit_columns(), flextable_dim(), height(), hrule(), ncol_keys(), nrow_part(), set_table_properties(), width()

Examples

Run this code
ft_1 <- qflextable(head(mtcars))
ft_1 <- width(ft_1, width = 1)
ft_1

ft_2 <- fit_to_width(ft_1, max_width = 4)
ft_2

Run the code above in your browser using DataLab