Learn R Programming

basictabler (version 0.3.1)

TableOpenXlsxStyles: A class that defines a collection of Excel styles as used by the openxlsx package.

Description

The TableOpenXlsxStyles class stores a collection of TableTableOpenXlsx style objects.

Arguments

Value

Object of R6Class with properties and methods that define styles/a theme for a table.

Format

R6Class object.

Fields

parentTable

Owning table.

Methods

Documentation

For more complete explanations and examples please see the extensive vignettes supplied with this package.

new(...)

Create a new set of styles, specifying the field values documented above.

findNamedStyle(baseStyleName)

Find an existing openxlsx style matching the name of a base style.

findOrAddStyle(action="findOrAdd", baseStyleName=NULL, isBaseStyle=NULL, style=NULL, mapFromCss=TRUE)

Find an existing openxlsx style and/or add a new openxlsx style matching a base style and/or TableStyle object.

addNamedStyles(mapFromCss=TRUE)

Populate the OpenXlsx styles based on the styles defined in the table.

asList()

Get a list representation of the styles.

asJSON()

Get a JSON representation of the styles.

asString()

Get a text representation of the styles.

Examples

Run this code
# NOT RUN {
# This class should not be used by end users.  It is an internal class
# created only by the BasicTable class.  It is used when rendering to Excel.
library(basictabler)
tbl <- qtbl(data.frame(a=1:2, b=3:4))
library(openxlsx)
wb <- createWorkbook(creator = Sys.getenv("USERNAME"))
addWorksheet(wb, "Data")
tbl$writeToExcelWorksheet(wb=wb, wsName="Data",
                         topRowNumber=1, leftMostColumnNumber=1,
                         applyStyles=TRUE, mapStylesFromCSS=TRUE)
# Use saveWorkbook() to save the Excel file.
# }

Run the code above in your browser using DataLab