---
source: https://carbone.io/examples/planification-medium/
title: "Project Planning Template | Carbone Examples"
description: "Learn how to create professional project planning reports with our document generator. Convert JSON data into beautiful documents using DOCX, PPTX, XLSX, and more formats."
generated_at: "2026-07-24"
---

# Planning with subtotals

Share your planning with Carbone

[![planification-medium thumbnail](/examples/planification-medium/thumb-result.webp)](/examples/planification-medium/result.pdf)

[Download Template](/examples/planification-medium/template.docx)

[Download data sample](/examples/planification-medium/data.json)

-   Template type document docx expert
-   Carbone min. v5.0.0+
-   Features loop filter alias aggregator
-   Target planning

## Overview

This guide shows you how to generate a professional planning report that includes:

-   Dynamic tables that adapt column widths between first and subsequent pages
-   Smart content layout that adjusts based on text length
-   Simple and maintainable template syntax
-   Automatic subtotal calculations for first-page items

## Step-by-Step Guide

Follow these steps to create your planning template:

### 1\. Calculate Characters per Line

First, create the initial table for page one. Since descriptions can vary in length and may take multiple lines, we need to:

-   Determine how many characters fit on one line based on your layout
-   Use 40 characters as a standard line length for this example

### 2\. Calculate Description Line Count

To determine how many lines each description needs:

-   Get the description length using the [:len](/documentation/design/formatters/text.md#len) formatter
-   Divide by characters per line (40) using [:div](/documentation/design/formatters/number.md#div-value)
-   Round up to the nearest whole number with [:ceil](/documentation/design/formatters/number.md#ceil)
-   Calculate running totals using [:cumSum](/documentation/design/computation/aggregation.md#cumsum-partitionby)
-   Store the result using [:set](/documentation/design/computation/store-and-transform.md)

Use this formula: `{d.steps[].description:len:div(40):ceil:cumSum:set(.nbRow)}`

This adds a `nbRow` property to each item, showing how many lines it needs in the first table.

**Input JSON Example**

```json
{
  "steps": [
    {
      "step": 1,
      "name": "Choosing the land",
      "duration_days": "30",
      "description": "Identify and visit several plots to assess location, viability, and utility connections. Finalize the purchase once the land is selected."
    },
    {...},
    {
      "step": 6,
      "name": "Foundations",
      "duration_days": "20",
      "description": "Dig trenches, pour the foundations, and set up the base structure."
    },
    {...}
  ]
}
```

**Output JSON Example**

```json
{
  "steps": [
    {
      "step": 1,
      "name": "Choosing the land",
      "duration_days": "30",
      "description": "Identify and visit several plots to assess location, viability, and utility connections. Finalize the purchase once the land is selected.",
      "nbRow": 4
    },
    {...},
    {
      "step": 6,
      "name": "Foundations",
      "duration_days": "20",
      "description": "Dig trenches, pour the foundations, and set up the base structure.",
      "nbRow": 22
    },
    {...}
  ]
}
```

### 3\. Create and Use Aliases

Use [aliases](/documentation/design/substitutions/aliases.md) to make your template code cleaner:

```text
{#steps = d.steps[i, nbRow < 22]}
{#steps2 = d.steps[i, nbRow > 21]}
```

Then use `{$steps.description}` and `{$steps2.description}` in your tables.

### 4\. Add Subtotal Calculations

Calculate subtotals using the [:aggSum](/documentation/design/computation/aggregation.md#learn-with-aggsum-partitionby) formatter: `{d.steps[nbRow<22].duration_days:aggSum}`

### Technical Tips for Better Layout

-   Prevent Row Breaks Across Pages
    
    -   Select the entire table
    -   Right-click → **Table Properties**
    -   Go to **Row** tab
    -   Uncheck "Allow rows to break across pages"
-   Repeat Headers on New Pages
    
    -   Select the table's header row
    -   Right-click → **Table Properties**
    -   Go to **Row** tab
    -   Check "Repeat as header row at the top of each page"

## Related Examples

[![classification-simple thumbnail example](/examples/classification-simple/thumb-result.webp)](/examples/classification-simple/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)
