Burahan T.
Burahan T.

Reputation: 3

How to align image at center using ExcelJS

here the code, which is insert image at last column in excel

      const img = new Image();
      img.src = reportTemplate.logo ? reportTemplate.logo : defaultLogo;
      const logoSize = 45;
      const imgHeight = img.width * (logoSize / img.height);

      const logo = workbook.addImage({
        base64: img.src,
        extension: 'png',
      });
      
      worksheet.addImage(logo, {
        tl: { col: tableLength - 1, row: 0 }, 
        ext: { width: imgHeight, height: logoSize},
        editAs:'oneCell',
      });

So I need to set alignment for inserted image at center same as expected result or solution to place image inside the cell then do alignment

Upvotes: 0

Views: 73

Answers (0)

Related Questions