R/TableOpenXlsxStyle.R
TableOpenXlsxStyle.Rd
The `TableOpenXlsxStyle` class specifies the styling for cells in an Excel worksheet.
R6Class
object.
baseStyleName
The name of the base style in the table.
isBaseStyle
`TRUE` when this style is the equivalent of a named style in the table, `FALSE` if this style has additional settings over and above the base style of the same name.
fontName
The name of the font (single font name, not a CSS style list).
fontSize
The size of the font (units: point).
bold
TRUE` if text is bold.
italic
`TRUE` if text is italic.
underline
`TRUE` if text is underlined.
strikethrough
`TRUE` if text has a line through it.
superscript
`TRUE` if text is small and raised.
subscript
`TRUE` if text is small and lowered.
fillColor
The background colour for the cell (as a hex value, e.g. #00FF00).
textColor
The color of the text (as a hex value).
hAlign
The horizontal alignment of the text: left, center or right.
vAlign
The vertical alignment of the text: top, middle or bottom.
wrapText
TRUE if the text is allowed to wrap onto multiple lines.
textRotation
The rotation angle of the text or 255 for vertical.
indent
The text indentation.
borderAll
A list (with elements style and color) specifying the border settings for all four sides of each cell at once.
borderLeft
A list (with elements style and color) specifying the border settings for the left border of each cell.
borderRight
A list (with elements style and color) specifying the border settings for the right border of each cell.
borderTop
A list (with elements style and color) specifying the border settings for the top border of each cell.
borderBottom
A list (with elements style and color) specifying the border settings for the bottom border of each cell.
valueFormat
The Excel formatting applied to the field value. One of the following values: "GENERAL", "NUMBER", "CURRENCY", "ACCOUNTING", "DATE", "LONGDATE", TIME, "PERCENTAGE", "FRACTION", "SCIENTIFIC", "TEXT", "COMMA". Or for dates/datetimes, a combination of d, m, y. Or for numeric values, use 0.00 etc.
minColumnWidth
The minimum width of this column.
minRowHeight
The minimum height of this row.
openxlsxStyle
The return value from openxlsx::createStyle().
new()
Create a new `TableOpenXlsxStyle` object.
TableOpenXlsxStyle$new( parentTable, baseStyleName = NULL, isBaseStyle = NULL, fontName = NULL, fontSize = NULL, bold = NULL, italic = NULL, underline = NULL, strikethrough = NULL, superscript = NULL, subscript = NULL, fillColor = NULL, textColor = NULL, hAlign = NULL, vAlign = NULL, wrapText = NULL, textRotation = NULL, indent = NULL, borderAll = NULL, borderLeft = NULL, borderRight = NULL, borderTop = NULL, borderBottom = NULL, valueFormat = NULL, minColumnWidth = NULL, minRowHeight = NULL )
parentTable
Owning table.
baseStyleName
The name of the base style in the table.
isBaseStyle
`TRUE` when this style is the equivalent of a named style in the table, `FALSE` if this style has additional settings over and above the base style of the same name.
fontName
The name of the font (single font name, not a CSS style list).
fontSize
The size of the font (units: point).
bold
`TRUE` if text is bold.
italic
`TRUE` if text is italic.
underline
`TRUE` if text is underlined.
strikethrough
`TRUE` if text has a line through it.
superscript
`TRUE` if text is small and raised.
subscript
`TRUE` if text is small and lowered.
fillColor
The background colour for the cell (as a hex value, e.g. #00FF00).
textColor
The color of the text (as a hex value).
hAlign
The horizontal alignment of the text: left, center or right.
vAlign
The vertical alignment of the text: top, middle or bottom.
wrapText
`TRUE` if the text is allowed to wrap onto multiple lines.
textRotation
The rotation angle of the text or 255 for vertical.
indent
The text indentation.
borderAll
A list (with elements style and color) specifying the border settings for all four sides of each cell at once.
borderLeft
A list (with elements style and color) specifying the border settings for the left border of each cell.
borderRight
A list (with elements style and color) specifying the border settings for the right border of each cell.
borderTop
A list (with elements style and color) specifying the border settings for the top border of each cell.
borderBottom
A list (with elements style and color) specifying the border settings for the bottom border of each cell.
valueFormat
The Excel formatting applied to the field value. One of the following values: "GENERAL", "NUMBER", "CURRENCY", "ACCOUNTING", "DATE", "LONGDATE", TIME, "PERCENTAGE", "FRACTION", "SCIENTIFIC", "TEXT", "COMMA". Or for dates/datetimes, a combination of d, m, y. Or for numeric values, use 0.00 etc.
minColumnWidth
The minimum width of this column.
minRowHeight
The minimum height of this row.
No return value.
isBasicStyleNameMatch()
Check if this style matches the specified base style name.
TableOpenXlsxStyle$isBasicStyleNameMatch(baseStyleName = NULL)
baseStyleName
The style name to compare to.
`TRUE` if the style name matches, `FALSE` otherwise.
isFullStyleDetailMatch()
Check if this style matches the specified style properties.
TableOpenXlsxStyle$isFullStyleDetailMatch( baseStyleName = NULL, isBaseStyle = NULL, fontName = NULL, fontSize = NULL, bold = NULL, italic = NULL, underline = NULL, strikethrough = NULL, superscript = NULL, subscript = NULL, fillColor = NULL, textColor = NULL, hAlign = NULL, vAlign = NULL, wrapText = NULL, textRotation = NULL, indent = NULL, borderAll = NULL, borderLeft = NULL, borderRight = NULL, borderTop = NULL, borderBottom = NULL, valueFormat = NULL, minColumnWidth = NULL, minRowHeight = NULL )
baseStyleName
The style name to compare to.
isBaseStyle
Whether the style being compared to is a base style.
fontName
The font name to compare to.
fontSize
The font size to compare to.
bold
The style property bold to compare to.
italic
The style property italic to compare to.
underline
The style property underline to compare to.
strikethrough
The style property strikethrough to compare to.
superscript
The style property superscript to compare to.
subscript
The style property subscript to compare to.
fillColor
The style property fillColor to compare to.
textColor
The style property textColor to compare to.
hAlign
The style property hAlign to compare to.
vAlign
The style property vAlign to compare to.
wrapText
The style property wrapText to compare to.
textRotation
The style property textRotation to compare to.
indent
The style property indent to compare to.
borderAll
The style property borderAll to compare to.
borderLeft
The style property borderLeft to compare to.
borderRight
The style property borderRight to compare to.
borderTop
The style property borderTop to compare to.
borderBottom
The style property borderBottom to compare to.
valueFormat
The style value format to compare to.
minColumnWidth
The style property minColumnWidth to compare to.
minRowHeight
The style property minRowHeight to compare to.
`TRUE` if the style matches, `FALSE` otherwise.
createOpenXslxStyle()
Create the `openxlsx` style based on the specified style properties.
TableOpenXlsxStyle$createOpenXslxStyle()
No return value.
asList()
Return the contents of this object as a list for debugging.
TableOpenXlsxStyle$asList()
A list of various object properties.
asJSON()
Return the contents of this object as JSON for debugging.
TableOpenXlsxStyle$asJSON()
A JSON representation of various object properties.
asString()
Return the contents of this object as a string for debugging.
TableOpenXlsxStyle$asString()
A character representation of various object properties.
clone()
The objects of this class are cloneable with this method.
TableOpenXlsxStyle$clone(deep = FALSE)
deep
Whether to make a deep clone.
# This class should only be created by using the functions in the table. # It is not intended to be created by users outside of the table. 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.