Product comparison table
Generate product comparison
- Template type document docx simple
- Carbone min. v4.24.0+
- Features bidirectional-loop placeholder
- Target product comparator insurance technology custom
Objectives
Generate product comparison tables with the following features:
- Use a horizontal loop to compare a variable number of products or companies
- Use placeholders to dynamically insert images (e.g., logos)
- Repeat the table header when a page breaks
Solution
Here’s how you can achieve this using Carbone:
Insert a table and define the elements to be displayed
- Go to the Insert menu, select Table and create a table (e.g., 3x3)
- Write the labels for columns. Use
[i]
and[i+1]
to define the horizontal loop
Example:
{d.datas[0].benchmark[i].product}
and{d.datas[0].benchmark[i+1].product}
- To display a logo, insert a temporary image. Use the View alt text menu to define the path of the logo
Example :
{d.datas[0].benchmark[i].logo}
Note: There is no need to duplicate the entire cell; a single tag with
[i+1]
is sufficient for each iterated array .
Define the Vertical Repetition
In the following rows, set up vertical iteration to display the relevant features from your data:
Example:
{d.datas[i].features[i].name} {d.datas[i].features[i+1]}
Conditional image
Insert a placeholder and use the View Alt Text menu to define the path of the marker to display
- Use the :ifEQ formatter to check the status of a feature and display a corresponding image based on the result
Example :
{d.datas[i].features[i].cols[i].status:ifEQ(1):show(d.legend.YES)}
- Multiple conditions can be defined one after another
Example:
{d.datas[i].features[i].cols[i].status:ifEQ(1):show(d.legend.YES):ifEQ(2):show(d.legend.OPTION):ifEQ(3):show(d.legend.NO)}
And there you go!
Tips
Prevent rows from breaking across pages
If you don’t want rows to break across pages, follow these steps:
- Highlight the table in the template.
- Right-click and go to the Table Properties menu.
- Navigate to the Row section.
- Deselect the option to allow rows to break across pages.
Repeat header rows on subsequent pages
If you want to repeat the first row when your table spans page 3 and beyond, follow these steps:
- Highlight the first row of your second table in the template.
- Right-click and go to the Table Properties menu.
- Navigate to the Row section.
- Select the option "Repeat as header row at the top of each page."
Perfect!
You might also like
Trusted by 600+ paid customers in 40+ countries














