Three functions manage the global flextable defaults:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/davidgohel/flextable/llms.txt
Use this file to discover all available pages before exploring further.
set_flextable_defaults()— override one or more defaultsget_flextable_defaults()— retrieve the current defaults as a listinit_flextable_defaults()— reset all defaults to package values
set_flextable_defaults()
Return value
A list of the previous default values. You can pass this list todo.call(set_flextable_defaults, old) to restore the previous state.
Parameters
Typography
Font family for characters in the Unicode range U+0000–U+007F. In Word output, set
hansi.family to the same value to support non-ASCII characters.Font size in points. Must be 0 or a positive integer.
Font color as a valid color string (e.g.,
"#000000" or "black").Word only. Font for complex script Unicode ranges (e.g., Arabic text using
"Arial Unicode MS").Word only. Font for East Asian Unicode ranges (e.g., Japanese text using
"MS Mincho").Word only. Font for Unicode ranges not covered by other categories.
Line spacing multiplier.
1 is single spacing; 2 is double spacing.Alignment and padding
Default text alignment:
"left", "right", "center", or "justify".Shortcut that sets all four cell paddings (top, bottom, left, right) at once.
Bottom cell padding in points.
Top cell padding in points.
Left cell padding in points.
Right cell padding in points.
Borders and background
Default border color (e.g.,
"#000000" or "black").Default border width in points.
Default cell background color.
Number and date formatting
Decimal separator used by
colformat_double(), colformat_num(). See formatC().Thousands separator used by
colformat_double(), colformat_int(), colformat_num(). See formatC().Number of decimal digits used by
colformat_double(). See formatC().Number of digits for percentage formatting.
String displayed in place of
NA values.String displayed in place of
NaN values.Date format string for
colformat_date(). Follows strptime() syntax. Default: "%Y-%m-%d".Datetime format string for
colformat_datetime(). Follows strptime() syntax. Default: "%Y-%m-%d %H:%M:%S".Table layout
Column-width algorithm:
"autofit" (default) or "fixed".Default horizontal alignment of the table on the page:
"left", "center", or "right".Word-specific
If
TRUE, enables the Word option “Allow row to break across pages”.Default for the
paginate() function’s “keep rows together” option.PDF (LaTeX) specific
Space between cell content and the left/right cell border.
Row height relative to default height. Default:
1.5.Floating placement in PDF:
"none" (default, inline), "float" (float to best position), "wrap-r", "wrap-l", "wrap-i", or "wrap-o" (text wrapping variants).If
TRUE, allows pdflatex to be used instead of xelatex or lualatex. Fonts are ignored because pdflatex does not support them.HTML-specific
Additional CSS instructions to inject into the table’s HTML output.
NULL for no scroll, or a list to enable a scroll box. See the scroll element of opts_html in set_table_properties().Themes and post-processing
A theme function name (character) or function applied automatically to each new flextable. Applied as the last step inside
flextable().A function applied to every flextable before output, regardless of format. Runs before any format-specific post-processing.
A function applied just before the table is printed to PDF.
A function applied just before the table is printed to Word.
A function applied just before the table is printed to HTML.
A function applied just before the table is printed to PowerPoint.
get_flextable_defaults()
Retrieve the current global defaults as a named list.Example
init_flextable_defaults()
Reset all global defaults to the package’s built-in values.Examples
Change font color and border color, then restore the previous state:See also
themes— available theme functionscolformat_double()— usesdigits,big.mark,decimal.mark, andna_strdefaultsset_table_properties()— per-table layout options