split_rows: Split a flextable into pages by rows

View source: R/splitters.R

split_rowsR Documentation

Split a flextable into pages by rows

Description

Split a flextable into a list of flextables whose body rows fit within a given height (in inches). Header and footer are repeated on every page. An optional group argument keeps row groups together (no page break inside a group).

Usage

split_rows(x, max_height, group = integer(0), unit = "in")

Arguments

x

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

max_height

Maximum height for each page, including header and footer (in inches by default).

group

Integer vector of body row indices that start a new group. Rows belonging to the same group are kept together on a single page. Default is integer(0) (no grouping, every row is independent).

unit

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

Value

A list of flextable objects. If no splitting is needed, a single-element list is returned.

Note

Footnotes are currently repeated on every page, even when they reference rows that only appear on a specific page. This limitation will be resolved in a future version when footnotes are restructured to track their association with body rows.

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_to_pages()

Examples

ft <- flextable(iris)
ft_pages <- split_rows(ft, max_height = 3)
length(ft_pages)

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