Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions vignettes/v07-flextable.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,32 @@ export_tfl(

When a flextable table is too tall to fit on a single page, `export_tfl()`
splits it across pages by subsetting body rows. The header is repeated on
each page.
each page, and caption and footnote are carried through to every page.

```{r pagination, fig.width = 11, fig.height = 8.5, out.width = "100%"}
big_data <- data.frame(
ID = seq_len(60),
Name = paste("Subject", seq_len(60)),
Age = sample(25:75, 60, replace = TRUE),
Weight = round(rnorm(60, 70, 12), 1),
Score = round(runif(60, 50, 100), 1),
Group = rep(c("Treatment", "Control"), each = 30)
)

```{r pagination, eval = FALSE}
big_ft <- flextable(mtcars[, 1:6]) |>
set_caption("All Motor Trend Cars") |>
add_footer_lines("Source: datasets package.")
big_ft <- flextable(big_data) |>
set_caption("Table 5. Subject Listing — Full Cohort") |>
add_footer_lines("Source: Simulated clinical trial data.") |>
theme_booktabs()

export_tfl(
big_ft,
file = "paginated.pdf",
preview = 1:2,
header_left = "Analysis Report",
header_rule = TRUE,
footer_rule = TRUE
)
```

Each page carries the same caption and footnote from the original
flextable object.

**Note:** When pagination occurs, per-cell formatting applied via
`color()`, `bg()`, `bold()`, etc. is not preserved on paginated pages.
Themes (e.g., `theme_vanilla()`) are not re-applied. For tables with
Expand Down
Loading