Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Add an image to excel using $.ig.excel
posted

Hello All,

My question is that,

How do I add an image in a worksheet using Ignite UI jquery excel library. I want to use ig.excel library in my angular js controller. I have added below code in controller.js file . Please check and give me some solution.

var workbook = new $.ig.excel.Workbook($.ig.excel.WorkbookFormat.excel2007);
var sheet = workbook.worksheets().add('Sheet1');
var image = new Image(100, 200);
image.src = 'banner.jpg';
var imageShape = new $.ig.excel.WorksheetImage(image);

imageShape.topLeftCornerCell().getCellAddressString(sheet.rows(0), 0, 0, true)
imageShape.bottomRightCornerCell().getCellAddressString(sheet.rows(5), 3, 0, true)
sheet.shapes().add(imageShape);

while running this code , below error is shown
Cannot call method 'getCellAddressString' of null

I am stuck with this problem . Please help.


Thanks.