empty_blanks: Make blank columns transparent

View source: R/styles.R

empty_blanksR Documentation

Make blank columns transparent

Description

Blank columns are set as transparent. This is a shortcut function that deletes top and bottom borders, changes the background color to transparent, displays empty content, and sets blank column widths.

Usage

empty_blanks(x, width = 0.05, unit = "in", part = "all")

Arguments

x

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

width

width of blank columns (.1 inch by default).

unit

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

part

part selector, see section Part selection with the part parameter in <Selectors in flextable>. Value 'all' can be used.

See Also

Other formatting shortcuts: align(), bg(), bold(), color(), font(), fontsize(), highlight(), indentation(), italic(), keep_with_next(), line_spacing(), padding(), rotate(), style(), tab_settings(), valign()

Examples

typology <- data.frame(
  col_keys = c(
    "Sepal.Length", "Sepal.Width", "Petal.Length",
    "Petal.Width", "Species"
  ),
  what = c("Sepal", "Sepal", "Petal", "Petal", " "),
  measure = c("Length", "Width", "Length", "Width", "Species"),
  stringsAsFactors = FALSE
)
typology

ftab <- flextable(head(iris), col_keys = c(
  "Species",
  "break1", "Sepal.Length", "Sepal.Width",
  "break2", "Petal.Length", "Petal.Width"
))
ftab <- set_header_df(ftab, mapping = typology, key = "col_keys")
ftab <- merge_h(ftab, part = "header")
ftab <- theme_vanilla(ftab)
ftab <- empty_blanks(ftab)
ftab <- width(ftab, j = c(2, 5), width = .1)
ftab

flextable documentation built on July 7, 2026, 5:06 p.m.