guigrpa / docx-templates

Template-based docx report creation
MIT License
904 stars 146 forks source link

Images based in FOR cycle #307

Closed arnamb closed 1 year ago

arnamb commented 1 year ago

I'm generating word document, which has several images (quantity of them is not known until last step). Is there any possibility, I could use FOR cycle to generate images?

For example.:

{ FOR image in imagesArray } { INS IMAGE image() } { END-FOR imagesArray }

The imagesArray would look something like this:

[ { image: 'someKindOfBase64Url-2' }, { image: 'someKindOfBase64Url-1 } ]

jjhbw commented 1 year ago

Yes something like that should be possible, but make sure to read the docs (README) first. Each image should be provided as { width: 6, height: 6, data, extension: '.gif' } and the INS and IMAGE commands should not be combined. You should only use IMAGE for your use case.

arnamb commented 1 year ago

Okay, I got it, thanks :) It worked :)

jjhbw commented 1 year ago

Ok great! I'll close the issue then.