Is there any way to insert image on image using mustache syntax or in java creating docx report?
In docx I declare background image like this: {{ Image:BackgroundImage }}. And I'am running this code.
Document doc = new Document(dataDir + "ImagesTemplate.docx");
doc.getMailMerge().execute(new String[]{"BackgroundImage","AnpotherImage"}, new Object[]{"image1.png","image2.png");
doc.save(dataDir + "ImageOutput.docx");
Of course paths to images are not constant. Is there's a way to insert image2 on to image1?
There is no such method in the Aspose.Words API to render image on another image. But, you can achieve this using custom code.
In your example, you passed both the background and foreground images, this means there will be two separate field. We need to pass just one field. In the custom code, we can put 2 or more images in it.
Field name in the Word template should also be "Image".
About the file name, I assumed that you pass only one file name e.g. "001-front.jpg". In the custom code, I will extract the background image using it. The corresponding image will be "001-back.jpg"
Now the custom override method for handling image.