body_end_section {officer} | R Documentation |
add a section in a Word document. A section affects preceding paragraphs or tables.
body_end_section(x, landscape = FALSE, margins = c(top = NA, bottom = NA, left = NA, right = NA), colwidths = c(1), space = 0.05, sep = FALSE, continuous = FALSE) body_default_section(x, landscape = FALSE, margins = c(top = NA, bottom = NA, left = NA, right = NA))
x |
an rdocx object |
landscape |
landscape orientation |
margins |
a named vector of margin settings in inches, margins not set remain at their default setting |
colwidths |
columns widths as percentages, summing to 1. If 3 values, 3 columns will be produced. |
space |
space in percent between columns. |
sep |
if TRUE a line is separating columns. |
continuous |
TRUE for a continuous section break. |
A section starts at the end of the previous section (or the beginning of
the document if no preceding section exists), and stops where the section is declared.
The function body_end_section()
is reflecting that Word concept.
The function body_default_section()
is only modifying the default section of
the document.
This function is deprecated, use body_end_section_continuous, body_end_section_landscape, body_end_section_portrait, body_end_section_columns or body_end_section_columns_landscape instead.
library(magrittr) str1 <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " %>% rep(10) %>% paste(collapse = "") my_doc <- read_docx() %>% # add a paragraph body_add_par(value = str1, style = "Normal") %>% # add a continuous section body_end_section(continuous = TRUE) %>% body_add_par(value = str1, style = "Normal") %>% body_add_par(value = str1, style = "Normal") %>% # preceding paragraph is on a new column slip_in_column_break(pos = "before") %>% # add a two columns continous section body_end_section(colwidths = c(.6, .4), space = .05, sep = FALSE, continuous = TRUE) %>% body_add_par(value = str1, style = "Normal") %>% # add a continuous section ... so far there is no break page body_end_section(continuous = TRUE) %>% body_add_par(value = str1, style = "Normal") %>% body_default_section(landscape = TRUE, margins = c(top = 0.5, bottom = 0.5)) print(my_doc, target = tempfile(fileext = ".docx"))