-1

I am trying to use a ClosedXML.Excel XLWorkbook dll to export Excel, but when trying to use an image, I get the following error:

Cannot convert Closedxml.excel.IXLAddress to Closedxml.excel.IXLCell:

                var image = WS.AddPicture(imagePath)
                    .MoveTo(WS.Cell("A1").Address)
                    .Scale(1.0); // optional: resize picture

enter image description here

I do not know if something is missing to install, some version that is not compatible or I don't know what it can be, of course, thanks for your attention.

Danilo
  • 148
  • 9

1 Answers1

2

The MoveTo() method needs a IXLCell as parameter, so just use

var image = WS.AddPicture(imagePath).MoveTo(WS.Cell("A1")).Scale(1.0);
Raidri
  • 17,258
  • 9
  • 62
  • 65
  • Thank you for responding, with the example you gave me, the image is superimposed on the texts and the size is not adjusted – Danilo Jan 06 '20 at 16:12