Learn R Programming

openxlsx2 (version 1.13)

create_fill: Create fill pattern

Description

This function creates fill patterns for a cell in a spreadsheet. Fill patterns can be simple solid colors or more complex gradient fills. For certain pattern types, two colors are needed.

Usage

create_fill(
  gradient_fill = "",
  pattern_type = "",
  bg_color = NULL,
  fg_color = NULL,
  ...
)

Value

A formatted fill pattern object to be used in a spreadsheet.

Arguments

gradient_fill

Character, specifying complex gradient fills.

pattern_type

Character, specifying the fill pattern type. Valid values are "none" (default), "solid", "mediumGray", "darkGray", "lightGray", "darkHorizontal", "darkVertical", "darkDown", "darkUp", "darkGrid", "darkTrellis", "lightHorizontal", "lightVertical", "lightDown", "lightUp", "lightGrid", "lightTrellis", "gray125", "gray0625".

bg_color

Character, specifying the background color in hex8 format (alpha, red, green, blue) for pattern fills.

fg_color

Character, specifying the foreground color in hex8 format (alpha, red, green, blue) for pattern fills.

...

Additional arguments passed to other methods.

See Also

wb_add_fill()

Other style creating functions: create_border(), create_cell_style(), create_colors_xml(), create_dxfs_style(), create_font(), create_numfmt(), create_tablestyle()

Examples

Run this code
# Create a solid fill pattern with foreground color
fill <- create_fill(
  pattern_type = "solid",
  fg_color = wb_color(hex = "FFFF0000")
)

Run the code above in your browser using DataLab