The 'Keep with next' functionality in 'Word', applied to the rows of a table, ensures that rows with that attribute stay together and do not break across multiple pages.
This function provides better control of page breaks than
the global keep_with_next parameter.
Arguments
- x
a 'flextable' object, see flextable-package to learn how to create 'flextable' object.
- i
row selector, see section Row selection with the
iparameter in <Selectors in flextable>.- value
TRUE or FALSE. When applied to a group, all rows except the last one should be flagged with the 'Keep with next' attribute.
- part
part selector, see section Part selection with the
partparameter in <Selectors in flextable>. Value 'all' is not allowed by the function.
See also
Other sugar functions for table style:
align(),
bg(),
bold(),
color(),
empty_blanks(),
font(),
fontsize(),
highlight(),
italic(),
line_spacing(),
padding(),
rotate(),
style(),
tab_settings(),
valign()
Examples
library(flextable)
dat <- iris[c(1:25, 51:75, 101:125), ]
ft <- qflextable(dat)
ft <- keep_with_next(
x = ft,
i = c(1:24, 26:49, 51:74),
value = TRUE
)
save_as_docx(ft, path = tempfile(fileext = ".docx"))
