-
Thanks for this great project. I'm wondering how to add images in the loop when use xlsx-renderer. I didn't see any information in the documents. And I saw you contributed the images for the ExcelJs. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
This comment has been hidden.
This comment has been hidden.
-
Hi @Jedliu About images, currently, it is possible to use only static images - it means, that it is able to put an image in a template, and it will be rendered in the output. There is no However, the desired result might be reached in one of two ways:
// render without images:
const workbook = await new Renderer().renderFromFile('./report-template.xlsx', reportData);
// POST-PROCESSING:
// add image @see https://github.com/exceljs/exceljs#add-image-to-workbook
const imageId = workbook.addImage({
buffer: fs.readFileSync('path/to.image.png'),
extension: 'png',
});
// apply image to cell rage @see https://github.com/exceljs/exceljs#add-image-over-a-range
workbook.worksheets[0].addImage(imageId, 'B2:D6');
Additionally, if want you support growing this project it is possible to order a feature: [email protected] |
Beta Was this translation helpful? Give feedback.
Hi @Jedliu
Could I ask you to add the template file which you used?
About images, currently, it is possible to use only static images - it means, that it is able to put an image in a template, and it will be rendered in the output. There is no
ImageCell
that would put dynamic images.However, the desired result might be reached in one of two ways: