Skip to main content
pankajk
New Participant
Sep 3, 2024 5:07 PM UTC
Solved

DOCX From Template display Image conditionally

Using plugin DOCX From Template to generate word doc and using image bookmark to display image, how can we display image conditionally, it should display image if i pass any image data from PM.

somasundaram.d
Employee
Sep 4, 2024 9:26 AM UTC

[mention:0ed83194bfa249d6923ad81b1a81d091:e9ed411860ed4f2ba0265705b8793d05] 

Try adding the below conditional logic

4 replies

justinw59
Inspiring
Sep 3, 2024 6:54 PM UTC

Can you see if IF statements work? freemarker.apache.org/.../ref_directive_if.html

In this example below, you could add a flag to your data model ("<showImage>true</showImage>") and then try wrapping the image list? Unfortunately, I've only been able to verify this with simple text - the plugin is giving me problems with the image input at the moment, so I haven't been able to test with your exact scenario.

somasundaram.d
Employee
Sep 4, 2024 9:26 AM UTC

[mention:0ed83194bfa249d6923ad81b1a81d091:e9ed411860ed4f2ba0265705b8793d05] 

Try adding the below conditional logic

pankajk
pankajkAuthor
New Participant
Sep 4, 2024 12:01 PM UTC

Thanks Somasundaram it worked.