Articles on: Tutorials

Insert dynamic images as shapes (rectangle with rounded corners)

Insert dynamic images as shapes



Supported only for the DOCX and PDF format. If you need images as shapes for ODT or ODS templates, contact the support team on the chat.

First Solution



Insert a shape into the document body, then fill it with an image.

1. Insert a shape into the document body



Click on the Insert tab > Shapes > Select the shape you need.



2. Draw the shape into the document body



To modify the angle radius of rounded rectangles in Microsoft Word, you can utilize the yellow handle located at the top left corner of the shape. Simply drag this yellow handle to adjust the roundness of the corners to your desired angle.



3. Fill the shape with an image



Click on the Shape format > Shape fill more icon > Pictures... > Select a picture from your computer, it will be used as placeholder image for Carbone.
The image must be a JPG or PNG format.



4. Set the Carbone Tag



To dynamically insert a picture into the document, you need to include a Carbone tag in the alternative text of the shape.
Follow these steps: right-click on the shape, select View Alt Text..., and insert the Carbone tag.



5. Generate the document with Carbone



The picture from your JSON dataset will be incorporated into the template to produce a document.

Generated DOCX with the french flag as picture

Second Solution



Insert an image into the document body, the crop the image as special shape

1. insert a picture as PNG or JPEG on the template



The temporary picture will be replaced by the new image coming from the JSON dataset.



2. Crop the image to a shape





3. Insert a Carbone tag in the alternative text of the image





4. Render the report with Carbone and voilà 🎉



Updated on: 02/12/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!