Hello,
API documentation says that there is not "getCellAddressString" method exposed by the topLeftCornerCell. You should instead pass a cell object to it as follows:
imageShape.topLeftCornerCell(sheet.getCell('C9'));
Please let me know if this solves the situation.
Thanks for the reply, but it does not solve the problem. It shows the below error
Cannot call method 'getHashCode' of null
Please help asap
Thanks,
Hi,
I am currently investigating this error and will update once I have more information.
Okay. Please give some solution as soon as possible.
You can track the status of the issue in the following case CAS*175080*K2G2H9
I have been facing the same issue, has this issue been fixed already?
To allow for a way to construct a WorksheetImage, there is the ability for the constructor to take a data url for a base 64 encoded image. Image element cannot be passed in order to create a WorksheetImage. Passing image need to be handled by the developer - e.g. handle the load of the image to wait for the image to be available, then draw that image into a canvas and then use the toDataUrl to have it create a data url that they could then use when creating a WorksheetImage. So to get the sample that was attached to work we need to convert the image to a base 64 image string.e.g.var image = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQUAAAAlCAMAAAB8kwwhAAABCFBMVEUAAAABmf9mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmYBmf9mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmYBmP9mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmYCmf8Bmf8Cmf8Cmf8AmP9mZmYBmf////8Ajf8JmP/G4/8Alv8Ai/+p1v/u9/8Aj/+Wzv/O5/8anP8Ak/+Lxv8fnP8Ae//h8f9mtf90u/8Afv+i0v/U6//B4v+63/8Ahv9Mq/97wv9ovP/P6v9hs//azDGiAAAAOHRSTlMA8PjkOF4aQLqVj06ewqMG3bICCmU32FgVcexHD/Ijavs8H3jG8NPNmDAp5q1ShLaKf6n7OjTi4pWcsSAAAAeZSURBVGje5Zppe9JAEMdXQiEBwhUkCYGEq5yFAl7RYqtV0ar1Pr7/NzGzRyZXE330Vf3XRzab7DG/nZ3dDZBHdzwdH98RH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Oi70hGOQXZRAGcxTAifrw4ubMbw5oC/I+A4aKeAZpZZMgUc/ERqk2CkHmKqs4/o0YGZVRLGKH0jyE3G3XcSwBOUjFIRaUEAUYZNNq/otrAlS2J8fvn9+mqzPwZXSMp2WAQnbcVpDEtacndmLZuRWwWmZCxHZzZZTclpOgQSltbzqNJauWTO1LS2libyeo5mm49j8WUeeSMu2bHaDXzk4puVXpjuOHqy8XIEK6+PqSvPnYHUKObM5QQqA4fLsJrEHgEKWtBr5N9IKQyOlrlphqJE/Urcw5NCQ3NCIf0+5j39v/z99Z53yRTX//B8pCNv/K1+491sU9rf8tywPxS+X8JdNfgokPm7175p+AcQh0p+Lw6joAAAAAElFTkSuQmCC"; var imageShape = new $.ig.excel.WorksheetImage(image);"
Hi Mathew,
You can download a working sample demonstrating how to insert image in Excel at https://ko.infragistics.com/community/forums/p/109480/515305.aspx#515305
I don't understand why you would not be able to execute code that creates an Excel worksheet in the image onload event, I think this should be possible, so you can send us a sample if you need assistance on this.
This also does not work as by the time the export happens the image has not loaded and that a shape of 0 width and 0 height is added and leaves me with a blank cell.
Unfortunately this function does not allow me to even inject the code into the onload function as this is then not possible to wait on so that the export does not continue regardless and add no images.
var image = new Image(50, 50);
image.src = args.cellValue;
var canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
canvas.getContext("2d").drawImage(image, 0, 0);
var imageUrl = canvas.toDataURL();
var imageShape = new $.ig.excel.WorksheetImage(imageUrl );
I seem to be experiencing this exact same issue:
// empty the cell args.xlRow.setCellValue(args.columnIndex, "");
var xlCell = args.xlRow.cells(args.columnIndex);
// load the image var image = new Image(50, 50); image.src = args.cellValue; var imageShape = new $.ig.excel.WorksheetImage(image);
// insert image into the workbook imageShape.topLeftCornerPosition({ x: 0.0, y: 0.0 }); imageShape.bottomRightCornerPosition({ x: 100.0, y: 100.0 }); imageShape.topLeftCornerCell(xlCell); imageShape.bottomRightCornerCell(xlCell); sender._worksheet.shapes().add(imageShape);
Any help on this issue would be great or is this just something that is not going to be supported?