% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wrappers.R
\name{createStyle}
\alias{createStyle}
\title{Create a cell style}
\usage{
createStyle(
  fontName = NULL,
  fontSize = NULL,
  fontColour = NULL,
  numFmt = openxlsx_getOp("numFmt", "GENERAL"),
  border = NULL,
  borderColour = openxlsx_getOp("borderColour", "black"),
  borderStyle = openxlsx_getOp("borderStyle", "thin"),
  bgFill = NULL,
  fgFill = NULL,
  halign = NULL,
  valign = NULL,
  textDecoration = NULL,
  wrapText = FALSE,
  textRotation = NULL,
  indent = NULL,
  locked = NULL,
  hidden = NULL
)
}
\arguments{
\item{fontName}{A name of a font. Note the font name is not validated. If fontName is NULL,
the workbook base font is used. (Defaults to Calibri)}

\item{fontSize}{Font size. A numeric greater than 0.
If fontSize is NULL, the workbook base font size is used. (Defaults to 11)}

\item{fontColour}{Colour of text in cell.  A valid hex colour beginning with "#"
or one of colours(). If fontColour is NULL, the workbook base font colours is used.
(Defaults to black)}

\item{numFmt}{Cell formatting
\itemize{
\item{\strong{GENERAL}}
\item{\strong{NUMBER}}
\item{\strong{CURRENCY}}
\item{\strong{ACCOUNTING}}
\item{\strong{DATE}}
\item{\strong{LONGDATE}}
\item{\strong{TIME}}
\item{\strong{PERCENTAGE}}
\item{\strong{FRACTION}}
\item{\strong{SCIENTIFIC}}
\item{\strong{TEXT}}
\item{\strong{COMMA}  for comma separated thousands}
\item{For date/datetime styling a combination of d, m, y and punctuation marks}
\item{For numeric rounding use "0.00" with the preferred number of decimal places}
}}

\item{border}{Cell border. A vector of "top", "bottom", "left", "right" or a single string).
\describe{
\item{\strong{"top"}}{ Top border}
\item{\strong{bottom}}{ Bottom border}
\item{\strong{left}}{ Left border}
\item{\strong{right}}{ Right border}
\item{\strong{TopBottom} or \strong{c("top", "bottom")}}{ Top and bottom border}
\item{\strong{LeftRight} or \strong{c("left", "right")}}{ Left and right border}
\item{\strong{TopLeftRight} or \strong{c("top", "left", "right")}}{ Top, Left and right border}
\item{\strong{TopBottomLeftRight} or \strong{c("top", "bottom", "left", "right")}}{ All borders}
}}

\item{borderColour}{Colour of cell border vector the same length as the number of sides specified in "border"
A valid colour (belonging to colours()) or a valid hex colour beginning with "#"}

\item{borderStyle}{Border line style vector the same length as the number of sides specified in "border"
\describe{
\item{\strong{none}}{ No Border}
\item{\strong{thin}}{ thin border}
\item{\strong{medium}}{ medium border}
\item{\strong{dashed}}{ dashed border}
\item{\strong{dotted}}{ dotted border}
\item{\strong{thick}}{ thick border}
\item{\strong{double}}{ double line border}
\item{\strong{hair}}{ Hairline border}
\item{\strong{mediumDashed}}{ medium weight dashed border}
\item{\strong{dashDot}}{ dash-dot border}
\item{\strong{mediumDashDot}}{ medium weight dash-dot border}
\item{\strong{dashDotDot}}{ dash-dot-dot border}
\item{\strong{mediumDashDotDot}}{ medium weight dash-dot-dot border}
\item{\strong{slantDashDot}}{ slanted dash-dot border}
}}

\item{bgFill}{Cell background fill colour.
A valid colour (belonging to colours()) or a valid hex colour beginning with "#".
--  \strong{Use for conditional formatting styles only.}}

\item{fgFill}{Cell foreground fill colour.
A valid colour (belonging to colours()) or a valid hex colour beginning with "#"}

\item{halign}{Horizontal alignment of cell contents
\describe{
\item{\strong{left}}{ Left horizontal align cell contents}
\item{\strong{right}}{ Right horizontal align cell contents}
\item{\strong{center}}{ Center horizontal align cell contents}
\item{\strong{justify}}{ Justify horizontal align cell contents}
}}

\item{valign}{A name
Vertical alignment of cell contents
\describe{
\item{\strong{top}}{ Top vertical align cell contents}
\item{\strong{center}}{ Center vertical align cell contents}
\item{\strong{bottom}}{ Bottom vertical align cell contents}
}}

\item{textDecoration}{Text styling.
\describe{
\item{\strong{bold}}{ Bold cell contents}
\item{\strong{strikeout}}{ Strikeout cell contents}
\item{\strong{italic}}{ Italicise cell contents}
\item{\strong{underline}}{ Underline cell contents}
\item{\strong{underline2}}{ Double underline cell contents}
\item{\strong{accounting}}{ Single accounting underline cell contents}
\item{\strong{accounting2}}{ Double accounting underline cell contents}
}}

\item{wrapText}{Logical. If \code{TRUE} cell contents will wrap to fit in column.}

\item{textRotation}{Rotation of text in degrees. 255 for vertical text.}

\item{indent}{Horizontal indentation of cell contents.}

\item{locked}{Whether cell contents are locked (if worksheet protection is turned on)}

\item{hidden}{Whether the formula of the cell contents will be hidden (if worksheet protection is turned on)}
}
\value{
A style object
}
\description{
Create a new style to apply to worksheet cells
}
\examples{
## See package vignettes for further examples

## Modify default values of border colour and border line style
options("openxlsx.borderColour" = "#4F80BD")
options("openxlsx.borderStyle" = "thin")

## Size 18 Arial, Bold, left horz. aligned, fill colour #1A33CC, all borders,
style <- createStyle(
  fontSize = 18, fontName = "Arial",
  textDecoration = "bold", halign = "left", fgFill = "#1A33CC", border = "TopBottomLeftRight"
)

## Red, size 24, Bold, italic, underline, center aligned Font, bottom border
style <- createStyle(
  fontSize = 24, fontColour = rgb(1, 0, 0),
  textDecoration = c("bold", "italic", "underline"),
  halign = "center", valign = "center", border = "Bottom"
)

# borderColour is recycled for each border or all colours can be supplied

# colour is recycled 3 times for "Top", "Bottom" & "Right" sides.
createStyle(border = "TopBottomRight", borderColour = "red")

# supply all colours
createStyle(border = "TopBottomLeft", borderColour = c("red", "yellow", "green"))
}
\seealso{
\code{\link[=addStyle]{addStyle()}}
}
\author{
Alexander Walker
}
