Skip to contents

Split a flextable into a list of flextables that fit within the given height and width constraints. Rows are split first, then columns are split within each row page.

This is a convenience wrapper around split_rows() and split_columns().

Usage

split_to_pages(
  x,
  max_width = NULL,
  max_height = NULL,
  rep_cols = NULL,
  group = integer(0),
  unit = "in"
)

Arguments

x

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

max_width

Maximum width per page (in inches by default). NULL means no column splitting.

max_height

Maximum height per page, including header and footer (in inches by default). NULL means no row splitting.

rep_cols

Columns to repeat on every horizontal page. Can be a character vector of column names, an integer vector of column positions, or NULL (default, no repetition).

group

Integer vector of body row indices that start a new group. Default is integer(0).

unit

Unit for max_width and max_height, one of "in", "cm", "mm".

Value

A list of flextable objects.

Examples

ft <- flextable(iris)
ft_pages <- split_to_pages(ft, max_width = 4, max_height = 5)
length(ft_pages)
#> [1] 22