R6 class for a Workbook
R6 class for a Workbook
The integer position of the sheet
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
A named
character
vector of sheet names in their order. The
names represent the original value of the worksheet prior to any
character substitutions.
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The sheet tables. character()
if empty
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
The wbWorkbook
object
Returns sheet visibility
The wbWorkbook
object
The wbWorkbook
object
a character vector of cell styles
A Workbook
fun
can be either of AVERAGE, COUNT, COUNTA, MAX, MIN, PRODUCT, STDEV,
STDEVP, SUM, VAR, VARP
minor helper wrapping xl_open which does the entire same thing
create_border
sheet_names
sheet_names
calcChain
calcChain
apps
apps
charts
charts
is_chartsheet
is_chartsheet
customXml
customXml
connections
connections
ctrlProps
ctrlProps
Content_Types
Content_Types
app
app
core
core
custom
custom
drawings
drawings
drawings_rels
drawings_rels
embeddings
embeddings
externalLinks
externalLinks
externalLinksRels
externalLinksRels
headFoot
headFoot
media
media
metadata
metadata
persons
persons
pivotTables
pivotTables
pivotTables.xml.rels
pivotTables.xml.rels
pivotDefinitions
pivotDefinitions
pivotRecords
pivotRecords
pivotDefinitionsRels
pivotDefinitionsRels
queryTables
queryTables
slicers
slicers
slicerCaches
slicerCaches
sharedStrings
sharedStrings
styles_mgr
styles_mgr
styles_xml
styles_xml
tables
tables
tables.xml.rels
tables.xml.rels
theme
theme
vbaProject
vbaProject
vml
vml
vml_rels
vml_rels
comments
comments
threadComments
threadComments
workbook
workbook
workbook.xml.rels
workbook.xml.rels
worksheets
worksheets
worksheets_rels
worksheets_rels
sheetOrder
The sheet order. Controls ordering for worksheets and worksheet names.
path
path
creator
A character vector of creators
title
title
subject
subject
category
category
datetimeCreated
The datetime (as POSIXt
) the workbook is
created. Defaults to the current Sys.time()
when the workbook object
is created, not when the Excel files are saved.
new()
Creates a new wbWorkbook
object
wbWorkbook$new(
creator = NULL,
title = NULL,
subject = NULL,
category = NULL,
datetimeCreated = Sys.time()
)
creator
character vector of creators. Duplicated are ignored.
title
title
subject
subject
category
category
datetimeCreated
The datetime (as POSIXt
) the workbook is
created. Defaults to the current Sys.time()
when the workbook object
is created, not when the Excel files are saved.
append()
Append a field. This method is intended for internal use
add_chartsheet()
Add a chart sheet to the workbook
wbWorkbook$add_chartsheet(
sheet = next_sheet(),
tabColor = NULL,
zoom = 100,
visible = c("true", "false", "hidden", "visible", "veryhidden"),
...
)
add_worksheet()
Add worksheet to the wbWorkbook
object
wbWorkbook$add_worksheet(
sheet = next_sheet(),
gridLines = TRUE,
rowColHeaders = TRUE,
tabColor = NULL,
zoom = 100,
header = NULL,
footer = NULL,
oddHeader = header,
oddFooter = footer,
evenHeader = header,
evenFooter = footer,
firstHeader = header,
firstFooter = footer,
visible = c("true", "false", "hidden", "visible", "veryhidden"),
hasDrawing = FALSE,
paperSize = getOption("openxlsx2.paperSize", default = 9),
orientation = getOption("openxlsx2.orientation", default = "portrait"),
hdpi = getOption("openxlsx2.hdpi", default = getOption("openxlsx2.dpi", default = 300)),
vdpi = getOption("openxlsx2.vdpi", default = getOption("openxlsx2.dpi", default = 300)),
...
)
sheet
sheet
gridLines
gridLines
rowColHeaders
rowColHeaders
tabColor
tabColor
zoom
zoom
header
header
footer
footer
oddHeader
oddHeader
oddFooter
oddFooter
evenHeader
evenHeader
evenFooter
evenFooter
firstHeader
firstHeader
firstFooter
firstFooter
visible
visible
hasDrawing
hasDrawing
paperSize
paperSize
orientation
orientation
hdpi
hdpi
vdpi
vdpi
...
...
clone_worksheet()
Clone a workbooksheet
wbWorkbook$clone_worksheet(old = current_sheet(), new = next_sheet())
add_data()
add data
wbWorkbook$add_data(
sheet = current_sheet(),
x,
startCol = 1,
startRow = 1,
dims = rowcol_to_dims(startRow, startCol),
array = FALSE,
xy = NULL,
colNames = TRUE,
rowNames = FALSE,
withFilter = FALSE,
name = NULL,
sep = ", ",
applyCellStyle = TRUE,
removeCellStyle = FALSE,
na.strings = na_strings(),
inline_strings = TRUE
)
sheet
sheet
x
x
startCol
startCol
startRow
startRow
dims
dims
array
array
xy
xy
colNames
colNames
rowNames
rowNames
withFilter
withFilter
name
name
sep
sep
applyCellStyle
applyCellStyle
removeCellStyle
if writing into existing cells, should the cell style be removed?
na.strings
Value used for replacing NA
values from x
. Default
na_strings()
uses the special #N/A
value within the workbook.
inline_strings
write characters as inline strings
return
The wbWorkbook
object
add_data_table()
add a data table
wbWorkbook$add_data_table(
sheet = current_sheet(),
x,
startCol = 1,
startRow = 1,
dims = rowcol_to_dims(startRow, startCol),
xy = NULL,
colNames = TRUE,
rowNames = FALSE,
tableStyle = "TableStyleLight9",
tableName = NULL,
withFilter = TRUE,
sep = ", ",
firstColumn = FALSE,
lastColumn = FALSE,
bandedRows = TRUE,
bandedCols = FALSE,
applyCellStyle = TRUE,
removeCellStyle = FALSE,
na.strings = na_strings(),
inline_strings = TRUE
)
sheet
sheet
x
x
startCol
startCol
startRow
startRow
dims
dims
xy
xy
colNames
colNames
rowNames
rowNames
tableStyle
tableStyle
tableName
tableName
withFilter
withFilter
sep
sep
firstColumn
firstColumn
lastColumn
lastColumn
bandedRows
bandedRows
bandedCols
bandedCols
applyCellStyle
applyCellStyle
removeCellStyle
if writing into existing cells, should the cell style be removed?
na.strings
Value used for replacing NA
values from x
. Default
na_strings()
uses the special #N/A
value within the workbook.
inline_strings
write characters as inline strings
add_pivot_table()
add pivot table
wbWorkbook$add_pivot_table(
x,
sheet = next_sheet(),
dims = "A3",
filter,
rows,
cols,
data,
fun,
params
)
x
a wb_data object
sheet
a worksheet
dims
the worksheet cell where the pivot table is placed
filter
a character object with names used to filter
rows
a character object with names used as rows
cols
a character object with names used as cols
data
a character object with names used as data
fun
a character object of functions to be used with the data
params
a list of parameters to modify pivot table creation
add_formula()
add formula
wbWorkbook$add_formula(
sheet = current_sheet(),
x,
startCol = 1,
startRow = 1,
dims = rowcol_to_dims(startRow, startCol),
array = FALSE,
xy = NULL,
applyCellStyle = TRUE,
removeCellStyle = FALSE
)
save()
Save the workbook
open()
open wbWorkbook in Excel.
interactive
If FALSE
will throw a warning and not open the path.
This can be manually set to TRUE
, otherwise when NA
(default) uses
the value returned from base::interactive()
buildTable()
Build table
wbWorkbook$buildTable(
sheet = current_sheet(),
colNames,
ref,
showColNames,
tableStyle,
tableName,
withFilter,
totalsRowCount = 0,
showFirstColumn = 0,
showLastColumn = 0,
showRowStripes = 1,
showColumnStripes = 0
)
copy_cells()
copy cells around in a workbook
wbWorkbook$copy_cells(
sheet = current_sheet(),
dims = "A1",
data,
as_value = FALSE,
as_ref = FALSE,
transpose = FALSE
)
set_base_font()
Get the base font
wbWorkbook$set_base_font(
fontSize = 11,
fontColor = wb_color(theme = "1"),
fontName = "Calibri",
...
)
set_bookview()
Set the book views
wbWorkbook$set_bookview(
activeTab = NULL,
autoFilterDateGrouping = NULL,
firstSheet = NULL,
minimized = NULL,
showHorizontalScroll = NULL,
showSheetTabs = NULL,
showVerticalScroll = NULL,
tabRatio = NULL,
visibility = NULL,
windowHeight = NULL,
windowWidth = NULL,
xWindow = NULL,
yWindow = NULL
)
activeTab
activeTab
autoFilterDateGrouping
autoFilterDateGrouping
firstSheet
firstSheet
minimized
minimized
showHorizontalScroll
showHorizontalScroll
showSheetTabs
showSheetTabs
showVerticalScroll
showVerticalScroll
tabRatio
tabRatio
visibility
visibility
windowHeight
windowHeight
windowWidth
windowWidth
xWindow
xWindow
yWindow
yWindow
setSheetName()
Deprecated. Use set_sheet_names()
instead
wbWorkbook$setSheetName(sheet = current_sheet(), name)
set_row_heights()
Sets a row height for a sheet
wbWorkbook$set_row_heights(
sheet = current_sheet(),
rows,
heights = NULL,
hidden = FALSE
)
remove_row_heights()
Sets a row height for a sheet
wbWorkbook$remove_row_heights(sheet = current_sheet(), rows)
createCols()
wbWorkbook$createCols(sheet = current_sheet(), n, beg, end)
group_cols()
Group cols
wbWorkbook$group_cols(
sheet = current_sheet(),
cols,
collapsed = FALSE,
levels = NULL
)
remove_col_widths()
Remove row heights from a worksheet
wbWorkbook$remove_col_widths(sheet = current_sheet(), cols)
set_col_widths()
Group cols
wbWorkbook$set_col_widths(
sheet = current_sheet(),
cols,
widths = 8.43,
hidden = FALSE
)
group_rows()
Group rows
wbWorkbook$group_rows(
sheet = current_sheet(),
rows,
collapsed = FALSE,
levels = NULL
)
remove_worksheet()
Remove a worksheet
wbWorkbook$remove_worksheet(sheet = current_sheet())
add_data_validation()
Adds data validation
wbWorkbook$add_data_validation(
sheet = current_sheet(),
cols,
rows,
type,
operator,
value,
allowBlank = TRUE,
showInputMsg = TRUE,
showErrorMsg = TRUE,
errorStyle = NULL,
errorTitle = NULL,
error = NULL,
promptTitle = NULL,
prompt = NULL
)
sheet
sheet
cols
cols
rows
rows
type
type
operator
operator
value
value
allowBlank
allowBlank
showInputMsg
showInputMsg
showErrorMsg
showErrorMsg
errorStyle
The icon shown and the options how to deal with such inputs. Default "stop" (cancel), else "information" (prompt popup) or "warning" (prompt accept or change input)
errorTitle
The error title
error
The error text
promptTitle
The prompt title
prompt
The prompt text
merge_cells()
Set cell merging for a sheet
wbWorkbook$merge_cells(sheet = current_sheet(), rows = NULL, cols = NULL)
unmerge_cells()
Removes cell merging for a sheet
wbWorkbook$unmerge_cells(sheet = current_sheet(), rows = NULL, cols = NULL)
freeze_pane()
Set freeze panes for a sheet
wbWorkbook$freeze_pane(
sheet = current_sheet(),
firstActiveRow = NULL,
firstActiveCol = NULL,
firstRow = FALSE,
firstCol = FALSE
)
add_comment()
Add comment
wbWorkbook$add_comment(
sheet = current_sheet(),
col,
row,
dims = rowcol_to_dims(row, col),
comment
)
remove_comment()
Remove comment
wbWorkbook$remove_comment(
sheet = current_sheet(),
col,
row,
dims = rowcol_to_dims(row, col),
gridExpand = TRUE
)
add_conditional_formatting()
Add conditional formatting
wbWorkbook$add_conditional_formatting(
sheet = current_sheet(),
cols,
rows,
rule = NULL,
style = NULL,
type = c("expression", "colorScale", "dataBar", "iconSet", "duplicatedValues",
"uniqueValues", "containsErrors", "notContainsErrors", "containsBlanks",
"notContainsBlanks", "containsText", "notContainsText", "beginsWith", "endsWith",
"between", "topN", "bottomN"),
params = list(showValue = TRUE, gradient = TRUE, border = TRUE, percent = FALSE, rank =
5L)
)
add_image()
Insert an image into a sheet
wbWorkbook$add_image(
sheet = current_sheet(),
file,
width = 6,
height = 3,
startRow = 1,
startCol = 1,
rowOffset = 0,
colOffset = 0,
units = "in",
dpi = 300
)
add_plot()
Add plot. A wrapper for add_image()
wbWorkbook$add_plot(
sheet = current_sheet(),
width = 6,
height = 4,
xy = NULL,
startRow = 1,
startCol = 1,
rowOffset = 0,
colOffset = 0,
fileType = "png",
units = "in",
dpi = 300
)
add_drawing()
Add xml drawing
wbWorkbook$add_drawing(sheet = current_sheet(), xml, dims = NULL)
add_chart_xml()
Add xml drawing
Add xml chart
wbWorkbook$add_chart_xml(sheet = current_sheet(), xml, dims = NULL)
add_mschart()
Add mschart chart to the workbook
wbWorkbook$add_mschart(sheet = current_sheet(), dims = NULL, graph)
add_form_control()
add form control to workbook
wbWorkbook$add_form_control(
sheet = current_sheet(),
dims = "A1",
type = NULL,
text = NULL,
link = NULL,
range = NULL,
checked = FALSE
)
print()
Prints the wbWorkbook
object
protect()
Protect a workbook
protect_worksheet()
protect worksheet
wbWorkbook$protect_worksheet(
sheet = current_sheet(),
protect = TRUE,
password = NULL,
properties = NULL
)
sheet
sheet
protect
protect
password
password
properties
A character vector of properties to lock. Can be one
or more of the following: "selectLockedCells"
,
"selectUnlockedCells"
, "formatCells"
, "formatColumns"
,
"formatRows"
, "insertColumns"
, "insertRows"
,
"insertHyperlinks"
, "deleteColumns"
, "deleteRows"
, "sort"
,
"autoFilter"
, "pivotTables"
, "objects"
, "scenarios"
page_setup()
page_setup()
wbWorkbook$page_setup(
sheet = current_sheet(),
orientation = NULL,
scale = 100,
left = 0.7,
right = 0.7,
top = 0.75,
bottom = 0.75,
header = 0.3,
footer = 0.3,
fitToWidth = FALSE,
fitToHeight = FALSE,
paperSize = NULL,
printTitleRows = NULL,
printTitleCols = NULL,
summaryRow = NULL,
summaryCol = NULL
)
set_header_footer()
Sets headers and footers
wbWorkbook$set_header_footer(
sheet = current_sheet(),
header = NULL,
footer = NULL,
evenHeader = NULL,
evenFooter = NULL,
firstHeader = NULL,
firstFooter = NULL
)
grid_lines()
grid lines
wbWorkbook$grid_lines(sheet = current_sheet(), show = FALSE, print = show)
add_named_region()
add a named region
wbWorkbook$add_named_region(
sheet = current_sheet(),
cols,
rows,
name,
localSheet = FALSE,
overwrite = FALSE,
comment = NULL,
customMenu = NULL,
description = NULL,
is_function = NULL,
functionGroupId = NULL,
help = NULL,
hidden = NULL,
localName = NULL,
publishToServer = NULL,
statusBar = NULL,
vbProcedure = NULL,
workbookParameter = NULL,
xml = NULL
)
sheet
sheet
cols
cols
rows
rows
name
name
localSheet
localSheet
overwrite
overwrite
comment
comment
customMenu
customMenu
description
description
is_function
function
functionGroupId
function group id
help
help
hidden
hidden
localName
localName
publishToServer
publish to server
statusBar
status bar
vbProcedure
wbProcedure
workbookParameter
workbookParameter
xml
xml
remove_named_region()
remove a named region
wbWorkbook$remove_named_region(sheet = current_sheet(), name = NULL)
set_sheet_visibility()
Set sheet visibility
wbWorkbook$set_sheet_visibility(sheet = current_sheet(), value)
add_page_break()
Add a page break
wbWorkbook$add_page_break(sheet = current_sheet(), row = NULL, col = NULL)
clean_sheet()
clean sheet (remove all values)
wbWorkbook$clean_sheet(
sheet = current_sheet(),
numbers = TRUE,
characters = TRUE,
styles = TRUE,
merged_cells = TRUE
)
add_border()
create borders for cell region
wbWorkbook$add_border(
sheet = current_sheet(),
dims = "A1",
bottom_color = wb_color(hex = "FF000000"),
left_color = wb_color(hex = "FF000000"),
right_color = wb_color(hex = "FF000000"),
top_color = wb_color(hex = "FF000000"),
bottom_border = "thin",
left_border = "thin",
right_border = "thin",
top_border = "thin",
inner_hgrid = NULL,
inner_hcolor = NULL,
inner_vgrid = NULL,
inner_vcolor = NULL,
...
)
sheet
a worksheet
dims
dimensions on the worksheet e.g. "A1", "A1:A5", "A1:H5"
bottom_color, left_color, right_color, top_color, inner_hcolor, inner_vcolor
a color, either something openxml knows or some RGB color
left_border, right_border, top_border, bottom_border, inner_hgrid, inner_vgrid
the border style, if NULL no border is drawn. See create_border for possible border styles
...
...
wb <- wb_workbook()
wb$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_border(1, dims = "A1:K1",
left_border = NULL, right_border = NULL,
top_border = NULL, bottom_border = "double")
wb$add_border(1, dims = "A5",
left_border = "dotted", right_border = "dotted",
top_border = "hair", bottom_border = "thick")
wb$add_border(1, dims = "C2:C5")
wb$add_border(1, dims = "G2:H3")
wb$add_border(1, dims = "G12:H13",
left_color = wb_color(hex = "FF9400D3"), right_color = wb_color(hex = "FF4B0082"),
top_color = wb_color(hex = "FF0000FF"), bottom_color = wb_color(hex = "FF00FF00"))
wb$add_border(1, dims = "A20:C23")
wb$add_border(1, dims = "B12:D14",
left_color = wb_color(hex = "FFFFFF00"), right_color = wb_color(hex = "FFFF7F00"),
bottom_color = wb_color(hex = "FFFF0000"))
wb$add_border(1, dims = "D28:E28")
# if (interactive()) wb$open()
wb <- wb_workbook()
wb$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_border(1, dims = "A2:K33", inner_vgrid = "thin", inner_vcolor = c(rgb="FF808080"))
add_fill()
provide simple fill function
wbWorkbook$add_fill(
sheet = current_sheet(),
dims = "A1",
color = wb_color(hex = "FFFFFF00"),
pattern = "solid",
gradient_fill = "",
every_nth_col = 1,
every_nth_row = 1,
...
)
sheet
the worksheet
dims
the cell range
color
the colors to apply, e.g. yellow: wb_color(hex = "FFFFFF00")
pattern
various default "none" but others are possible: "solid", "mediumGray", "darkGray", "lightGray", "darkHorizontal", "darkVertical", "darkDown", "darkUp", "darkGrid", "darkTrellis", "lightHorizontal", "lightVertical", "lightDown", "lightUp", "lightGrid", "lightTrellis", "gray125", "gray0625"
gradient_fill
a gradient fill xml pattern.
every_nth_col
which col should be filled
every_nth_row
which row should be filled
...
...
add_font()
provide simple font function
wbWorkbook$add_font(
sheet = current_sheet(),
dims = "A1",
name = "Calibri",
color = wb_color(hex = "FF000000"),
size = "11",
bold = "",
italic = "",
outline = "",
strike = "",
underline = "",
charset = "",
condense = "",
extend = "",
family = "",
scheme = "",
shadow = "",
vertAlign = "",
...
)
sheet
the worksheet
dims
the cell range
name
font name: default "Calibri"
color
rgb color: default "FF000000"
size
font size: default "11",
bold
bold
italic
italic
outline
outline
strike
strike
underline
underline
charset
charset
condense
condense
extend
extend
family
font family
scheme
font scheme
shadow
shadow
vertAlign
vertical alignment
...
...
wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_font("S1", "A1:K1", name = "Arial", color = wb_color(theme = "4"))
add_numfmt()
provide simple number format function
wbWorkbook$add_numfmt(sheet = current_sheet(), dims = "A1", numfmt)
sheet
the worksheet
dims
the cell range
numfmt
number format id or a character of the format
wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_numfmt("S1", "A1:A33", numfmt = 1)
add_cell_style()
provide simple cell style format function
wbWorkbook$add_cell_style(
sheet = current_sheet(),
dims = "A1",
applyAlignment = NULL,
applyBorder = NULL,
applyFill = NULL,
applyFont = NULL,
applyNumberFormat = NULL,
applyProtection = NULL,
borderId = NULL,
extLst = NULL,
fillId = NULL,
fontId = NULL,
hidden = NULL,
horizontal = NULL,
indent = NULL,
justifyLastLine = NULL,
locked = NULL,
numFmtId = NULL,
pivotButton = NULL,
quotePrefix = NULL,
readingOrder = NULL,
relativeIndent = NULL,
shrinkToFit = NULL,
textRotation = NULL,
vertical = NULL,
wrapText = NULL,
xfId = NULL
)
sheet
the worksheet
dims
the cell range
applyAlignment
logical apply alignment
applyBorder
logical apply border
applyFill
logical apply fill
applyFont
logical apply font
applyNumberFormat
logical apply number format
applyProtection
logical apply protection
borderId
border ID to apply
extLst
extension list something like <extLst>...</extLst>
fillId
fill ID to apply
fontId
font ID to apply
hidden
logical cell is hidden
horizontal
align content horizontal ('left', 'center', 'right')
indent
logical indent content
justifyLastLine
logical justify last line
locked
logical cell is locked
numFmtId
number format ID to apply
pivotButton
unknown
quotePrefix
unknown
readingOrder
reading order left to right
relativeIndent
relative indentation
shrinkToFit
logical shrink to fit
textRotation
degrees of text rotation
vertical
vertical alignment of content ('top', 'center', 'bottom')
wrapText
wrap text in cell
xfId
xf ID to apply
wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_cell_style("S1", "A1:K1",
textRotation = "45",
horizontal = "center",
vertical = "center",
wrapText = "1")
get_cell_style()
get sheet style
wbWorkbook$get_cell_style(sheet = current_sheet(), dims)
set_cell_style()
set sheet style
wbWorkbook$set_cell_style(sheet = current_sheet(), dims, style)
clone_sheet_style()
clone style from one sheet to another
wbWorkbook$clone_sheet_style(from = current_sheet(), to)
add_sparklines()
apply sparkline to worksheet
wbWorkbook$add_sparklines(sheet = current_sheet(), sparklines)
## ------------------------------------------------
## Method `wbWorkbook$add_border`
## ------------------------------------------------
wb <- wb_workbook()
wb$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_border(1, dims = "A1:K1",
left_border = NULL, right_border = NULL,
top_border = NULL, bottom_border = "double")
wb$add_border(1, dims = "A5",
left_border = "dotted", right_border = "dotted",
top_border = "hair", bottom_border = "thick")
wb$add_border(1, dims = "C2:C5")
wb$add_border(1, dims = "G2:H3")
wb$add_border(1, dims = "G12:H13",
left_color = wb_color(hex = "FF9400D3"), right_color = wb_color(hex = "FF4B0082"),
top_color = wb_color(hex = "FF0000FF"), bottom_color = wb_color(hex = "FF00FF00"))
wb$add_border(1, dims = "A20:C23")
wb$add_border(1, dims = "B12:D14",
left_color = wb_color(hex = "FFFFFF00"), right_color = wb_color(hex = "FFFF7F00"),
bottom_color = wb_color(hex = "FFFF0000"))
wb$add_border(1, dims = "D28:E28")
# if (interactive()) wb$open()
wb <- wb_workbook()
wb$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_border(1, dims = "A2:K33", inner_vgrid = "thin", inner_vcolor = c(rgb="FF808080"))
## ------------------------------------------------
## Method `wbWorkbook$add_fill`
## ------------------------------------------------
# example from the gradient fill manual page
gradient_fill <- "<gradientFill degree=\"90\">
<stop position=\"0\"><color rgb=\"FF92D050\"/></stop>
<stop position=\"1\"><color rgb=\"FF0070C0\"/></stop>
</gradientFill>"
## ------------------------------------------------
## Method `wbWorkbook$add_font`
## ------------------------------------------------
wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_font("S1", "A1:K1", name = "Arial", color = wb_color(theme = "4"))
## ------------------------------------------------
## Method `wbWorkbook$add_numfmt`
## ------------------------------------------------
wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_numfmt("S1", "A1:A33", numfmt = 1)
## ------------------------------------------------
## Method `wbWorkbook$add_cell_style`
## ------------------------------------------------
wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_cell_style("S1", "A1:K1",
textRotation = "45",
horizontal = "center",
vertical = "center",
wrapText = "1")