Skip to main content
January 17, 2024
Question

Error adding more than one image in a document- plugin ( Advanced Document Templating )

  • January 17, 2024
  • 5 replies
  • 0 views

Hi

when I generate a word document with an image example: {logo: CONS!APP_IMAGE} works perfectly, but when I have more than one image in the template. For example logo2 and I call the smart service as follows {logo: CONS!APP_IMAGE, logo2: CON!APP_IMAGE2} I get the following error: freemarker.core.NonSequenceOrCollectionException: The value you try to list is an extended_hash+string (fr.opensagres.xdocreport.document.images.ByteArrayImageProvider wrapped into f.e.b.StringModel), thus you must specify two loop variables after the "as"; one for the key, and another for the value, like <#... as k, v>). ---- FTL stack trace ("~" means nesting-related): - Failed at: #list logo as logo [in template "fr.opensagres.xdocreport.document.docx.DocxReport@7f2dbfc!word/document.xml" at line 4, column 6773]

---- Plugin: Advanced Document Templating

     Version: 1.1.0

     Smart Service: DOCX From Dynamic Template

5 replies

konduruc733182
January 17, 2024

Hello  pablol9292,

Could you please share the code part of Logo/Image fro your DOCX template. And how did you define it? have you defined it as a list? I have faced a similar issue but it was resolved when I changed the size of the image block and its positioning. Never understood the exact reason.

January 19, 2024

Thank you for your reply Konduru. Yes, I defined as a list as follows:

For the first image: «[#list logo as logo]»
«[/#list]»

For he second image: «[#list logo1 as logo1]»
«[/#list]»

It works when I test it with only one image

[View:/cfs-file/__key/communityserver-discussions-components-files/19/images.docx:320:240]

mathieud0001
January 19, 2024

Might just be a typo but in your original post you have the 2nd logo defined as logo2 but your word doc references logo1.

{logo: CONS!APP_IMAGE, logo2: CON!APP_IMAGE2}

and in your word doc 

«[#list logo as logo]»
«[/#list]»

«[#list logo1 as logo1]»
«[/#list]»