% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read_xlsx.R
\name{xlsx_styles}
\alias{xlsx_styles}
\title{Style manager for xlsx workbooks}
\description{
R6 class that manages fonts, fills, borders, and
cell formats in an xlsx workbook's \code{styles.xml}. Used internally
by \code{\link[=sheet_write_data]{sheet_write_data()}} and available for extensions.
}
\keyword{internal}
\section{Methods}{
\subsection{Public methods}{
  \itemize{
    \item \href{#method-xlsx_styles-initialize}{\code{xlsx_styles$new()}}
    \item \href{#method-xlsx_styles-get_font_id}{\code{xlsx_styles$get_font_id()}}
    \item \href{#method-xlsx_styles-get_fill_id}{\code{xlsx_styles$get_fill_id()}}
    \item \href{#method-xlsx_styles-get_border_id}{\code{xlsx_styles$get_border_id()}}
    \item \href{#method-xlsx_styles-get_style_id}{\code{xlsx_styles$get_style_id()}}
    \item \href{#method-xlsx_styles-get_xf_id}{\code{xlsx_styles$get_xf_id()}}
    \item \href{#method-xlsx_styles-save}{\code{xlsx_styles$save()}}
    \item \href{#method-xlsx_styles-clone}{\code{xlsx_styles$clone()}}
  }
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-xlsx_styles-initialize"></a>}}
\if{latex}{\out{\hypertarget{method-xlsx_styles-initialize}{}}}
\subsection{\code{xlsx_styles$new()}}{
  Initialize styles from an xlsx package directory.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{xlsx_styles$new(package_dir)}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{package_dir}}{path to the unpacked xlsx directory}
    }
    \if{html}{\out{</div>}}
  }
}

\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-xlsx_styles-get_font_id"></a>}}
\if{latex}{\out{\hypertarget{method-xlsx_styles-get_font_id}{}}}
\subsection{\code{xlsx_styles$get_font_id()}}{
  Get or create a font index.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{xlsx_styles$get_font_id(
  name = "Calibri",
  size = 11,
  bold = FALSE,
  italic = FALSE,
  underline = FALSE,
  color = "000000"
)}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{name}}{font family name}
      \item{\code{size}}{font size in points}
      \item{\code{bold}}{logical, bold}
      \item{\code{italic}}{logical, italic}
      \item{\code{underline}}{logical, underline}
      \item{\code{color}}{hex color string (6 chars, without \verb{#})}
    }
    \if{html}{\out{</div>}}
  }
}

\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-xlsx_styles-get_fill_id"></a>}}
\if{latex}{\out{\hypertarget{method-xlsx_styles-get_fill_id}{}}}
\subsection{\code{xlsx_styles$get_fill_id()}}{
  Get or create a fill index.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{xlsx_styles$get_fill_id(bg_color = "FFFFFF")}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{bg_color}}{hex color string for fill background}
    }
    \if{html}{\out{</div>}}
  }
}

\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-xlsx_styles-get_border_id"></a>}}
\if{latex}{\out{\hypertarget{method-xlsx_styles-get_border_id}{}}}
\subsection{\code{xlsx_styles$get_border_id()}}{
  Get or create a border index.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{xlsx_styles$get_border_id(
  top_style = NULL,
  top_color = NULL,
  bottom_style = NULL,
  bottom_color = NULL,
  left_style = NULL,
  left_color = NULL,
  right_style = NULL,
  right_color = NULL
)}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{top_style}}{border style for top side}
      \item{\code{top_color}}{border color for top side}
      \item{\code{bottom_style}}{border style for bottom side}
      \item{\code{bottom_color}}{border color for bottom side}
      \item{\code{left_style}}{border style for left side}
      \item{\code{left_color}}{border color for left side}
      \item{\code{right_style}}{border style for right side}
      \item{\code{right_color}}{border color for right side}
    }
    \if{html}{\out{</div>}}
  }
}

\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-xlsx_styles-get_style_id"></a>}}
\if{latex}{\out{\hypertarget{method-xlsx_styles-get_style_id}{}}}
\subsection{\code{xlsx_styles$get_style_id()}}{
  Get or create a cell format (xf) index.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{xlsx_styles$get_style_id(
  font_id = 0L,
  fill_id = 0L,
  border_id = 0L,
  num_fmt_id = 0L,
  halign = NA,
  valign = NA,
  text_rotation = 0L,
  wrap_text = FALSE
)}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{font_id}}{integer, font index (0-based)}
      \item{\code{fill_id}}{integer, fill index (0-based)}
      \item{\code{border_id}}{integer, border index (0-based)}
      \item{\code{num_fmt_id}}{integer, number format id}
      \item{\code{halign}}{horizontal alignment}
      \item{\code{valign}}{vertical alignment}
      \item{\code{text_rotation}}{text rotation angle (0-180)}
      \item{\code{wrap_text}}{logical, enable text wrapping}
    }
    \if{html}{\out{</div>}}
  }
}

\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-xlsx_styles-get_xf_id"></a>}}
\if{latex}{\out{\hypertarget{method-xlsx_styles-get_xf_id}{}}}
\subsection{\code{xlsx_styles$get_xf_id()}}{
  Get or create a cell format index for a number format.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{xlsx_styles$get_xf_id(num_fmt_id)}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{num_fmt_id}}{integer, number format id}
    }
    \if{html}{\out{</div>}}
  }
}

\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-xlsx_styles-save"></a>}}
\if{latex}{\out{\hypertarget{method-xlsx_styles-save}{}}}
\subsection{\code{xlsx_styles$save()}}{
  Save styles.xml to disk.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{xlsx_styles$save()}
    \if{html}{\out{</div>}}
  }
}

\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-xlsx_styles-clone"></a>}}
\if{latex}{\out{\hypertarget{method-xlsx_styles-clone}{}}}
\subsection{\code{xlsx_styles$clone()}}{
  The objects of this class are cloneable with this method.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{xlsx_styles$clone(deep = FALSE)}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{deep}}{Whether to make a deep clone.}
    }
    \if{html}{\out{</div>}}
  }
}

}
