optilude / xlsx-template

A NodeJS module to generate Excel files in .xlsx format from a template created with Excel itself
MIT License
398 stars 144 forks source link

image error with 1.3.2 #168

Open smolleyes opened 2 years ago

smolleyes commented 2 years ago

hi

i have this error with 1.3.2 and can t get any image working with any other version :(

TypeError: Cannot read properties of null (reading 'asText') 1|extranet-api | 2022-08-26 15:23 +02:00: at Workbook.module.exports.Workbook.loadDrawing (/home/srv/websites/batexpert-api/node_modules/xlsx-template/lib/index.js:592:77)

someone have success adding images with this module ?

thanks

smolleyes commented 2 years ago

hi

someone still maintaining this module ?

thanks

Eraledm commented 1 year ago

Same issue here

Eraledm commented 1 year ago

I forked the repo and it looks like tests are working correctly so I tested with my own xlsx file and turns out an embedded image was breaking this feature:

Screen Shot 2022-11-18 at 10 34 52 p m

I haven't had time to check the code and figure out what's the real issue, I tested removing that image and adding other png images and it works as expected, so my current solution was just remove that image and add another one.

Hope it helps

kant2002 commented 1 year ago

If somebody have file and short sample of code that may help troubleshoot an issue

Eraledm commented 1 year ago

Sure, test-insert-images.xlsx The original excel was from a client, I modified it to keep the same format of the testing files so you can delete the image object and validate that the tests passes but if you keep the image then the tests fails

kant2002 commented 1 year ago

@Eraledm can you take a look at release 1.4.0 and I was not able to repro an issue. Maybe you can create some small repro app ?

smolleyes commented 1 year ago

hi!

in my case it seems that the checkbox are creating the problem... if i remove them everything works... for information

kant2002 commented 1 year ago

@smolleyes do you experience this error with 1.4.0 too?

smolleyes commented 1 year ago

with the "bad" excel yes

kant2002 commented 1 year ago

@smolleyes can you give me test file similar to wha Eraledm provide which trigger this behaviour?

interrizky commented 1 year ago

Upgrade it to 1.4.3 version and still having the issue. Have tried using buffer, base64 and path too. It says:

TypeError: Cannot read properties of null (reading 'asText') at Workbook.loadDrawing (../node_modules/xlsx-template/lib/index.js:517:77)

jdugh commented 8 months ago

@smolleyes , @interrizky @Eraledm : Can you provide a simple template, with the image and a simple source script to reproduce your problem? We use this module daily and the image insertion works fine for us.