Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Replace Placeholder Image v1.4.2 #181

Open
interrizky opened this issue Jun 19, 2023 · 1 comment
Open

Can't Replace Placeholder Image v1.4.2 #181

interrizky opened this issue Jun 19, 2023 · 1 comment

Comments

@interrizky
Copy link

interrizky commented Jun 19, 2023

Am trying to replace placeholder image in my template

My code using NodeJS

const XlsxTemplate = require('xlsx-template')

const options = { imagePath: 'path/to/dir/image }
const template = new XlsxTemplate(data, options)

const image = req.body.fileImageName
const sheetNumber = 1
const values = { photo: image }

template.substitute(sheetNumber, values)
const buff = template.generate({
  type: "nodebuffer",
  compression: "DEFLATE",
})

In my template, I use:
${image: photo}

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

Anyone can solve this problems? I have seen the templates and outputs in this github. Also with the same problems in issues tab. I also had done using Buffer and Base64 but return the same

@interrizky
Copy link
Author

@jdugh hi, i have just read your reply on the different section of the problems. Since I have posted my code here, I check you in here to have a look.

Do you use it in daily basis? What version do you usually use? For temporary, I then decide to use docx template rather than xlsx template.

Any of my images/photos work in docx template but not in xlsx template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant