R/excel_colnamesStyle.R

Defines functions excel_colnamesStyle

Documented in excel_colnamesStyle

#' excel_colnamesStyle
#'
#' @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_colnamesStyle <- function(wbCon,
                               fontHeight = 14,
                               fontBold = T,
                               fontItalic = F,
                               fontName = "Calibri",
                               fontColor = "white",
                               fillBackgroundColor = "#2ca25f",
                               fillForegroundColor = "#2ca25f",
                               fillPattern = "SOLID_FOREGROUND",
                               borderColor = "black",
                               borderPosition = c("TOP", "BOTTOM", "LEFT", "RIGHT"),
                               borderPen=c("BORDER_THIN", "BORDER_THIN", "BORDER_THIN", "BORDER_THIN") ,
                               alignmentH = "ALIGN_RIGHT",
                               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.