class Axlsx::OneCellAnchor

The recommended way to manage drawings, images and charts is Worksheet#add_chart or Worksheet#add_image.

This class details a single cell anchor for drawings.

Creates a new OneCellAnchor object and an Pic associated with it.


  • drawing (Drawing)
  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • start_at (Array)

    the col, row to start at

  • width (Integer)
  • height (Integer)
  • image_src (String)

    the file location of the image you will render

  • name (String)

    the name attribute for the rendered image

  • descr (String)

    the description of the image rendered

The drawing that holds this anchor

converts the pixel width and height to EMU units and returns a hash of !{:cx=>, :cy=>

A marker that defines the from cell anchor. The default from column and row are 0 and 0 respectively

the height of the graphic object in pixels this is converted to EMU at a 92 ppi resolution

The index of this anchor in the drawing

The object this anchor hosts

sets the starting position for the anchor. You can provide a String like “A1”, an array like [0,0] or a cell object for the x parameter. We just 'figure it out' for you.


  • x (Array, String, Cell, Integer)

    Accepts many inputs for defining the starting position of the cell.

  • y (Integer) (defaults to: 0)

    When x is an integer, this value is used for the row index at which the anchor starts.

Serializes the object


  • str (String) (defaults to: '')

the width of the graphic object in pixels. this is converted to EMU at a 92 ppi resolution

OneCellAnchor is referenced in 0 repositories