rubyXL icon indicating copy to clipboard operation
rubyXL copied to clipboard

Copy an image from one sheet to another sheet?

Open MyklClason opened this issue 3 years ago • 0 comments

So here is what I'm trying to do:

  1. Given an excel file with a single sheet it in (the template sheet)
  2. Duplicate that sheet one or more times and changes each sheet (IE: Add rows)
  3. The template sheet has an image in it.

This is working generally fine thanks to: https://stackoverflow.com/questions/29507841/create-multiple-sheets-that-uses-same-template-using-rubyxl

However, I'm having trouble figuring out how to copy the image. I tried the following based roughly on how cells was handled but didn't work out, and after a fair bit of digging around rows and cells I'm a bit stuck as to what to try next. It looks like the row data might have something in but it's a bit to buried for me to debug (ran into an infinite loop of too much nesting trying to inspect it).

worksheet.generic_storage = template.generic_storage.map(&:dup)

MyklClason avatar Aug 16 '22 07:08 MyklClason