R/excel_basicStyle.R

Defines functions excel_basicStyle

Documented in excel_basicStyle

#' xlsx_basicStyle
#'
#' @param wbCon
#' @param fontHeight
#' @param fontBold
#' @param fontItalic
#' @param fontName
#' @param fontColor
#' @param fillBackgroundColor
#' @param fillForegroundColor
#' @param fillPattern
#' @param borderColor
#' @param borderPosition
#' @param borderPen
#' @param alignmentH
#' @param alignmentV
#'
#' @return
#' @export
#'
#' @examples
excel_basicStyle <- function(wbCon,
                            fontHeight = 11,
                            fontBold = F,
                            fontItalic = F,
                            fontName = "Calibri",
                            fontColor = "#000005",
                            fillBackgroundColor = "white",
                            fillForegroundColor = "white",
                            fillPattern = "SOLID_FOREGROUND",
                            borderColor = "black",
                            borderPosition = c("TOP", "BOTTOM", "LEFT", "RIGHT"),
                            borderPen= c("BORDER_THIN", "BORDER_THIN", "BORDER_THIN", "BORDER_THIN"),
                            alignmentH = "ALIGN_CENTER",
                            alignmentV = "VERTICAL_CENTER"
) {
  style <- xlsx::CellStyle(wbCon) +
    xlsx::Font(wbCon, heightInPoints=fontHeight, isBold=fontBold, isItalic=fontItalic,
         name=fontName, color=fontColor) +
    xlsx::Fill(backgroundColor = fillBackgroundColor, foregroundColor = fillForegroundColor,
         pattern = fillPattern) +
    xlsx::Border(color=borderColor,
           position=borderPosition,
           pen=borderPen) +
    xlsx::Alignment(h=alignmentH, v = alignmentV)
  return(style)
}
kiwimic/prettyExcelExpoRt documentation built on Nov. 4, 2019, 3:53 p.m.