% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xl_rich_string.R
\name{xl_rich_string}
\alias{xl_rich_string}
\alias{is_xl_rich_string}
\alias{as.character.xl_rich_string}
\title{A cell whose text has several formats}
\usage{
xl_rich_string(...)

is_xl_rich_string(x)

\method{as.character}{xl_rich_string}(x, ...)
}
\arguments{
\item{...}{Runs, in order.  A bare string is taken as an unformatted run; an
[xl_rich_run()] carries its own font.  Lists of either are flattened, so
runs can be assembled programmatically.}

\item{x}{An object to test.}
}
\value{
An `xl_rich_string` object: a list of runs.
}
\description{
`xl_rich_string()` builds the value of a single cell out of differently
formatted runs, so that one cell can read "This is **bold** text".  Pass it
as the `value` of [xl_cell_general()].

Excel requires at least two runs: a string with one format is an ordinary
character value, so pass it as one.

`as.character()` returns the cell's text with the per-run fonts dropped.
}
\examples{
xl_rich_string("This is ", xl_rich_run("bold", xl_font(bold = TRUE)), " text")

# in a cell, with a cell-wide format alongside the per-run fonts
xl_cell_general(
  value  = xl_rich_string("2 H", xl_rich_run("2", xl_font(script = "sub")), "O"),
  format = xl_align(horizontal = "center")
)
}
\seealso{
[xl_rich_run], [xl_cell_general], [xl_font]

Other cell content:
\code{\link[=is_xl_comment]{is_xl_comment()}},
\code{\link[=xl_cell_general]{xl_cell_general()}},
\code{\link[=xl_comment]{xl_comment()}},
\code{\link[=xl_formula]{xl_formula()}},
\code{\link[=xl_rich_run]{xl_rich_run()}}
}
\concept{cell content}
