xlsx_drawing: Drawing manager for xlsx sheets

xlsx_drawingR Documentation

Drawing manager for xlsx sheets

Description

R6 class that manages a drawing file for an xlsx sheet. Used internally by sheet_add_drawing() methods.

Super class

officer::openxml_document -> xlsx_drawing

Methods

Public methods

Inherited methods

Method new()

Create or reuse a drawing for a sheet.

Usage
xlsx_drawing$new(package_dir, sheet_obj, content_type)
Arguments
package_dir

path to the unpacked xlsx directory

sheet_obj

a sheet R6 object

content_type

a content_type R6 object


Method add_chart_anchor()

Add a chart anchor to the drawing (absolute placement in inches from the top-left corner of the sheet).

Usage
xlsx_drawing$add_chart_anchor(
  chart_rid,
  left = 1,
  top = 1,
  width = 6,
  height = 4
)
Arguments
chart_rid

relationship id of the chart

left, top

top-left anchor in inches

width, height

size in inches


Method add_chart_rel()

Add a relationship from the drawing to a chart file.

Usage
xlsx_drawing$add_chart_rel(chart_basename)
Arguments
chart_basename

filename of the chart XML


Method add_image_rel()

Add a relationship from the drawing to a media image.

Usage
xlsx_drawing$add_image_rel(image_basename)
Arguments
image_basename

filename (without directory) of the image sitting in ⁠xl/media/⁠.


Method add_image_anchor()

Add an image anchor to the drawing (absolute placement in inches from the top-left corner of the sheet).

Usage
xlsx_drawing$add_image_anchor(
  image_rid,
  left = 1,
  top = 1,
  width = 2,
  height = 2,
  alt = ""
)
Arguments
image_rid

relationship id of the image

left, top

top-left anchor in inches

width, height

size in inches

alt

alternative text


Method clone()

The objects of this class are cloneable with this method.

Usage
xlsx_drawing$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


officer documentation built on April 24, 2026, 5:06 p.m.