exceljs: workbook.addImage is not a function
I have installed latest version of exceljs, however I’m still getting error workbook.addImage is not a function when i’m trying to add any image to the workbook.
PS: I have 0.4.10 version
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 1
- Comments: 19 (1 by maintainers)
Problem is when we create a workbook using writer stream then it doesn’t find function
addImage(). However you can also use the following to add an image.Otherwise simply use below to create a worksheet and it works,
let workbook = new Excel.Workbook()This issue is a major release blocker. Surprised that, its not being addressed… Right now, its impossible to use addImage using the WorkbookWriter. Any workaround mentioned here won’t work.
Guys, do you know any other library that supports all functionality in WorkbookWriter and easy to switch from exceljs(semantically similar)?
nothing yet? I’m trying to create a stream too, but, also having this error
workbook.media.push({ filename: './img/logo.png', extension: 'png', }) worksheet.addImage(0, 'B1:E6')<- TypeError: worksheet.addImage is not a functionGot this working by converting my image to base64 via https://www.base64-image.de/ and then adding it in. Please see code below. Work Great!
var myBase64Image = “data:image/jpeg;base64,/9…”; var logo = workbook.addImage({ base64: myBase64Image, extension: ‘jpeg’, }); worksheet.addImage(logo, ‘N2:O2’);
got the same thing. no error, but it does not work tho. it does not proceed in writeBuffer().
@Abouyer20 The maintainer is too busy and won’t be able to contribute for the next few months. The non-streaming version had the same problem and was fixed, maybe you can get some pointers from here: https://github.com/guyonroche/exceljs/issues/374