split_to_pages: Split a flextable into pages by rows and columns

View source: R/splitters.R

split_to_pagesR Documentation

Split a flextable into pages by rows and columns

Description

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.

See Also

Other row and column operations: add_body(), add_body_row(), add_footer(), add_footer_lines(), add_footer_row(), add_header(), add_header_lines(), add_header_row(), delete_columns(), delete_part(), delete_rows(), paginate(), separate_header(), set_header_footer_df, set_header_labels(), split_columns(), split_rows()

Examples

ft <- flextable(iris)
ft_pages <- split_to_pages(ft, max_width = 4, max_height = 5)
length(ft_pages)

flextable documentation built on June 2, 2026, 9:08 a.m.