| wb_add_image {openxlsx2} | R Documentation | 
Insert an image into a worksheet
Description
Insert an image into a worksheet
Usage
wb_add_image(
  wb,
  sheet = current_sheet(),
  dims = "A1",
  file,
  width = 6,
  height = 3,
  row_offset = 0,
  col_offset = 0,
  units = "in",
  dpi = 300,
  ...
)
Arguments
wb | 
 A workbook object  | 
sheet | 
 A name or index of a worksheet  | 
dims | 
 Dimensions where to plot. Default absolute anchor, single cell (eg. "A1") oneCellAnchor, cell range (eg. "A1:D4") twoCellAnchor  | 
file | 
 An image file. Valid file types are:  | 
width | 
 Width of figure.  | 
height | 
 Height of figure.  | 
row_offset | 
 offset vector for one or two cell anchor within cell (row)  | 
col_offset | 
 offset vector for one or two cell anchor within cell (column)  | 
units | 
 Units of width and height. Can be   | 
dpi | 
 Image resolution used for conversion between units.  | 
... | 
 additional arguments  | 
See Also
wb_add_chart_xml() wb_add_drawing() wb_add_mschart() wb_add_plot()
Examples
img <- system.file("extdata", "einstein.jpg", package = "openxlsx2")
wb <- wb_workbook()$
  add_worksheet()$
  add_image("Sheet 1", dims = "C5", file = img, width = 6, height = 5)$
  add_worksheet()$
  add_image(dims = "B2", file = img)$
  add_worksheet()$
  add_image(dims = "G3", file = img, width = 15, height = 12, units = "cm")
[Package openxlsx2 version 1.8 Index]