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.

Parents
No Data
Reply
  • 16310
    Offline posted

    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.

Children