---
source: https://carbone.io/examples/matrix-pptx/
title: "Grid of stars | Carbone Sample"
description: "Create stunning reports quickly with our simple document generator. Merge JSON data with templates in DOCX, PPTX, XLSX, ODT, ODP, ODS, HTML, MD, XML, and more."
generated_at: "2026-07-13"
---

# Grid layout in a presentation

Generate stunning slides effortlessly with Carbone

[![matrix-pptx thumbnail](/examples/matrix-pptx/thumb-result.webp)](/examples/matrix-pptx/result.pdf)

[Download Template](/examples/matrix-pptx/template.pptx)

[Download data sample](/examples/matrix-pptx/data.json)

-   Template type document pptx expert
-   Carbone min. v5.0.0+
-   Features loop transform
-   Target bank insurance quote

## Overview

Learn how to create a grid layout of objects in a PowerPoint presentation (PPTX) with these features:

-   Automatically arrange items in rows and columns
-   Create a responsive gallery layout

> _Note: This template works within a single slide. For larger grids, consider using a DOCX template with custom paper size (33cm x 19cm) or an ODP template._

## Step-by-Step Solution

Follow these steps to create a grid layout in your PPTX template using Carbone:

### 1\. Create the Base Shape

-   Insert a **shape** (such as a text block) into your slide
-   Add your content using [Carbone tags](/documentation/design/substitutions/the-basics.md)
-   Duplicate the shape and update the iteration syntax to `{d.stars[i+1]}`

_Tip: Always use shapes instead of images or tables for better results_

### 2\. Configure Grid Layout

-   Right-click on the first shape
-   Select **View Alt Text** menu
-   Add the following transformation formulas:

```text
{d.stars[i].starName:print(.i):mod(5):mul(6):transform(x,cm)}
{d.stars[i].starName:print(.i):div(5):floor:mul(4):transform(y,cm)} 
```

These formulas control the grid layout:

-   `:print(.i)` - Gets the current loop iterator using the [:print](/documentation/design/formatters/text.md#print-message) formatter
-   `:mod(5)` - Sets number of items per row (5 columns) using the [:mod](/documentation/design/formatters/number.md#mod-value) formatter
-   `:mul(6)` - Sets horizontal spacing (6cm) using the [:mul](/documentation/design/formatters/number.md#mul-value) formatter
-   `:transform(x, cm)` - Applies the transformation on the x-axis in centimeters using the [:transform](/documentation/design/advanced-features/transform.md) formatter

The second formula works similarly but controls vertical positioning using `:div(5):floor` to calculate row numbers.

## Related Examples

[![sensor-readings thumbnail example](/examples/sensor-readings/thumb-result.webp)](/examples/sensor-readings/index.md)

## Trusted by 800+ paid customers in 40+ countries

## Related topics

- [Transport ticket](/examples/ticket/index.md)
- [Summary](/examples/summary/index.md)
- [Stock inventory spreadsheet](/examples/stock-inventory-spreadsheet/index.md)
- [Store Inventory](/examples/shoes/index.md)
- [Sensor readings](/examples/sensor-readings/index.md)
- [Real estate property document](/examples/real-estate-property-description/index.md)
