% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/docx_section.R
\name{body_end_block_section}
\alias{body_end_block_section}
\title{Add any section}
\usage{
body_end_block_section(x, value)
}
\arguments{
\item{x}{an rdocx object}

\item{value}{a \link{block_section} object}
}
\description{
Add a section to the document. You can
define any section with a \link{block_section} object. All other
\verb{body_end_section_*} are specialized, this one is highly flexible
but it's up to the user to define the section properties.
}
\section{Section model in Word}{

A \code{block_section} added with \code{body_end_block_section()} applies to the
content that \strong{precedes} the call: it closes the section that holds the
previous paragraphs / tables and inherits any layout (orientation, columns,
margins, headers / footers) defined by the \code{block_section}. The function
name reflects this: it marks the \emph{end} of a section.

Typical pattern: add the content, then close it with the section that
should layout it.

\if{html}{\out{<div class="sourceCode r">}}\preformatted{doc <- read_docx() |>
  body_add_par("This paragraph is in landscape orientation.") |>
  body_end_block_section(block_section(prop_section(
    page_size = page_size(orient = "landscape")
  )))
}\if{html}{\out{</div>}}

The default section of the document (defined by the template or by
\code{\link[=body_set_default_section]{body_set_default_section()}}) closes any content added after the last
\code{body_end_block_section()} call.

The RTF output uses the opposite model: \code{rtf_add(block_section(...))}
applies to the content that \emph{follows} the call. See \code{\link[=rtf_add]{rtf_add()}}.
}

\section{Illustrations}{


\if{html}{\figure{body_end_block_section_doc_1.png}{options: style="width:80\%;"}}
}

\examples{
library(officer)
str1 <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
str1 <- rep(str1, 20)
str1 <- paste(str1, collapse = " ")

ps <- prop_section(
  page_size = page_size(orient = "landscape"),
  page_margins = page_mar(top = 2),
  type = "continuous"
)

doc_1 <- read_docx()
doc_1 <- body_add_par(doc_1, value = str1, style = "Normal")
doc_1 <- body_add_par(doc_1, value = str1, style = "Normal")

doc_1 <- body_end_block_section(doc_1, block_section(ps))

doc_1 <- body_add_par(doc_1, value = str1, style = "centered")

print(doc_1, target = tempfile(fileext = ".docx"))
}
\seealso{
Other functions for Word sections:
\code{\link[=body_end_section_columns]{body_end_section_columns()}},
\code{\link[=body_end_section_columns_landscape]{body_end_section_columns_landscape()}},
\code{\link[=body_end_section_continuous]{body_end_section_continuous()}},
\code{\link[=body_end_section_landscape]{body_end_section_landscape()}},
\code{\link[=body_end_section_portrait]{body_end_section_portrait()}},
\code{\link[=body_set_default_section]{body_set_default_section()}}
}
\concept{functions for Word sections}
