1

I have had no luck figuring out how to insert an image (a gif in this case) created in perl with GD directly into an excel workbook, without first saving the image to a file. Is this possible using win32::OLE or one of the perl spreadsheet modules, or is there another trick I'm missing?

What I've tried: searching google, stackoverflow, perlmonks

modules: - spreadsheet::writeexcel - excel::writer::xlsx

win32::OLE - Pictures->Insert - Shapes->AddPicture

All require a file as input; there was ONE (rejected) bug/patch to spreadsheet::writeexcel to allow inline images, but it didn't quite work and I'm disinclined to use non-baseline modules... any ideas?

m2-so
  • 11
  • 1

1 Answers1

1

Neither Spreadsheet::WriteExcel or Excel::Write::XLSX support adding images from anything other than a file.

I would suggest creating the images as temporary files, inserting them into a worksheet with Excel::Writer::XLSX (which has better image handling) and then removing the temporary files.

jmcnamara
  • 38,196
  • 6
  • 90
  • 108
  • Thanks for the feedback, I have that solution working now (though I'm using win32::OLE instead of a spreadsheet module module), but was hoping for a more elegant solution, for portability reasons as well as aesthetics. I was kind of hoping I was missing something obvious, or perhaps for a xyz::picture::inline solution... – m2-so Apr 17 '14 at 17:01