---
title: "Layout multiple images across or down"
description: "Layout multiple images in Docmosis templates by grouping them across columns or down rows."
canonical_url: "https://resources.docmosis.com/template-tutorials/stepping-images"
last_reviewed: 2026-06-12
---
# Layout multiple images across or down
The [Stepping \- Data](/template-tutorials/stepping-data) example showed how data could be arranged into steps or groups of size “N” through the “:stepN” and “:stepNdown” directives – the “N” referring to the number of columns of data to be shown.
When stepping Docmosis will automatically create the variables $i1, $i2, etc. – so that you can identify and work with each item of data during each step.
As with data, there may be times when it is useful to display images in “steps”. This can be used with either the \<\Bookmark**.
### LibreOffice
In LibreOffice, image names can contain both the ‘.’ (dot) and the $ character. Therefore, it is possible to directly reference the stepping variables in the names given to the placeholder images. There is no need to create new variables as is the case with Microsoft Word.
For example, in Example 1 of the LibreOffice Template, the first placeholder image is named img\_$i1\.square which will directly reference the first stepping image variable.
Right\-click on the image and select **Properties** from the menu. In the **Options** tab, type a name in the **Name** edit box.
**Note:** As all the placeholder images in a LibreOffice template need unique image names, you will notice that different variable names have been necessary to refer to the stepping variables in Examples 2 \& 3\.
The image names used in our LibreOffice Template are as follows: \-
**Example 1:\**Placeholder Image 1 Name \= img\_$i1\.square \
Placeholder Image 2 Name \= img\_$i2\.square \
Placeholder Image 3 Name \= img\_$i3\.square
**Example 2:\**Placeholder Image 1 Name \= img\_$squ1 \
Placeholder Image 2 Name \= img\_$squ2 \
Placeholder Image 3 Name \= img\_$squ3 \
Placeholder Image 4 Name \= img\_$squ4
**Example 3:\**Placeholder Image 1 Name \= img\_$sq1 \
Placeholder Image 2 Name \= img\_$sq2
## Stepping across
The examples below demonstrate how to step across.
### Example 1
This example aligns with Example 1 in [Stepping \- Data](/template-tutorials/stepping-data), using a repeating section to show stepping across, in groups of 3 coloured squares, via the “:step3” directive.
##### **Microsoft Word**
Within the repeating loop, the stepping variables $i1\.square, $i2\.square and $i3\.square are assigned to the new variables $square1, $square2 and $square3 which are then referred to in the bookmark names given to the placeholder images.
$i1\.square → $square1 → img\_var\_square1 (bookmark) \
$i2\.square → $square2 → img\_var\_square2 (bookmark) \
$i3\.square → $square3 → img\_var\_square3 (bookmark)
**LibreOffice**
Within the repeating loop, the stepping variables $i1\.square, $i2\.square and $i3\.square are referred to directly by the names given to the placeholder images.
$i1\.square → img\_$i1\.square (image name) \
$i2\.square → img\_$i2\.square (image name) \
$i3\.square → img\_$i3\.square (image name)
##### **Output**
Docmosis will loop through all seven images, displaying the first 3, then the second 3, then the last 1\.
### Example 2
This example aligns with Example 2 in [Stepping \- Data](/template-tutorials/stepping-data), using repeating rows in a table structure to show stepping across, in groups of 4 coloured squares, via the “:step4” directive.
You will notice that each stepping variable assignment and its related placeholder image has been placed in a separate table cell. A smaller font has been used to assign each stepping variable to its new associated bookmark/image variable so it can nicely fit within the cell.
##### **Microsoft Word**
Within the repeating loop, the stepping variables $i1\.square, $i2\.square, $i3\.square, $i4\.square are assigned to the new variables $squ1, $squ2, $squ3, $squ4 which are then referred to in the bookmark names given to the placeholder images.
$i1\.square → $squ1 → img\_var\_squ1 (bookmark) \
$i2\.square → $squ2 → img\_var\_squ2 (bookmark) \
$i3\.square → $squ3 → img\_var\_squ3 (bookmark) \
$i4\.square → $squ4 → img\_var\_squ4 (bookmark)
##### **LibreOffice**
As we have already referred to the stepping variables $i1\.square, $i2\.square, $i3\.square in the placeholder image names in Example 1, there is a need to create new variables and assign them to the four stepping variables in this example.
$i1\.square → $squ1 → img\_$squ1 (image name) \
$i2\.square → $squ2 → img\_$squ2 (image name) \
$i3\.square → $squ3 → img\_$squ3 (image name) \
$i4\.square → $squ4 → img\_$squ4 (image name)
##### **Output**
Docmosis will loop through all seven images, displaying the first 4 then the last 3\.
## Stepping down
The examples below demonstrate how to step across.
### Example 3
This example is similar to Example 3 in [Stepping \- Data](/template-tutorials/stepping-data), showing how the “:step2down” directive” arranges the colour squares in a downwards fashion using 2 columns.
As with Stepping Data, Docmosis automatically balances the squares into the right number of rows, in this case 4 rows.
##### **Microsoft Word**
Within the repeating loop, the stepping variables $i1\.square and $i2\.square are assigned to the new variables $sq1 and $sq2 which are then referred to in the bookmark names given to the placeholder images.
$i1\.square → $sq1 → img\_var\_sq1 (bookmark) \
$i2\.square → $sq2 → img\_var\_sq2 (bookmark)
##### **LibreOffice**
As we have already referred to the stepping variables $i1\.square and $i2\.square in the placeholder image names in Example 1, there is a need to create new variables and assign them to the two stepping variables in this example.
$i1\.square → $sq1 → img\_$sq1 (image name) \
$i2\.square → $sq2 → img\_$sq2 (image name)
##### **Output**
Docmosis will loop through all seven images and display two at a time. Because step2down has been used, it will group/order them with the first 4 images in the left column then the last 3 images in the right column.
# Layout multiple images across or down - related json data
```json
{
"squareSet": [
{
"colour": "yellow",
"square": "image:base64:[base64 omitted]"
},
{
"colour": "green",
"square": "image:base64:[base64 omitted]"
},
{
"colour": "blue",
"square": "image:base64:[base64 omitted]"
},
{
"colour": "purple",
"square": "image:base64:[base64 omitted]"
},
{
"colour": "orange",
"square": "image:base64:[base64 omitted]"
},
{
"colour": "pink",
"square": "image:base64:[base64 omitted]"
},
{
"colour": "red",
"square": "image:base64:iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAIAAAADnC86AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAASdAAAEnQB3mYfeAAAADdJREFUWEftzTERACAMADGEdKx/Z3jAxbPkLnvOnf1CnBFnxBlxRpwRZ8QZcUacEWfEGXFGHJl9vqhZqiHY5sMAAAAASUVORK5CYII="
}
]
}
```
# Layout multiple images across or down - example template syntax
```docmosis
**Stepping – Images**
**Coloured squareSet:**
\<\\> \<\\>
**Stepping Across\**
Example 1\
\<\\>
\<\<$square1\=$i1\.square\>\>\<\<$square2\=$i2\.square\>\>\<\<$square3\=$i3\.square\>\>
\<\\>
Example 2
| \<\\> | | | |
| --- | --- | --- | --- |
| \<\<$squ1\=$i1\.square\>\> | \<\<$squ2\=$i2\.square\>\> | \<\<$squ3\=$i3\.square\>\> | \<\<$squ4\=$i4\.square\>\> |
| \<\\> | | | |
**Stepping Down**
Example 3
\<\\>
\<\<$sq1\=$i1\.square\>\>\<\<$sq2\=$i2\.square\>\>
\<\\>
```