Design
DOCX templates
Design a document in Word, add Carbone tags, and generate it from JSON data as a Word file or a PDF.
COMMUNITY FEATURE
Available for:
Carbone Cloud
Carbone On-premise
Embedded Carbone JS
v2.0+
Any DOCX file can be a template. Write Carbone tags in its text, tables, headers and footers, and send your JSON data to the API. You get back a Word document or a PDF that keeps the layout of the template. Use it for invoices, reports and certificates, like a branded PDF invoice, a monthly sales report with a bar chart or a certificate of completion.
Basic
Write a tag in the document to insert a value from the JSON data. In {d.customer.name}, d is the root of the data and customer.name is the path to the value. The value takes the formatting of its tag: font, size, color and bold, like the order number.
{
"date": "November 10, 2026",
"customer": {
"firstName": "Emma",
"name": "Emma Johnson",
"company": "Bluebird Logistics",
"address": "350 Fifth Avenue, Suite 4100\nNew York, NY 10118"
},
"order": { "id": "SO-2026-0042", "items": 12, "deliveryDate": "November 17, 2026" },
"manager": { "name": "Jane Smith", "title": "Account Manager" }
}
Text of template.docx
Acme Corporation
500 Market Street, San Francisco, CA 94105
{d.date}
{d.customer.name}
{d.customer.company}
{d.customer.address:convCRLF}
Order confirmation {d.order.id}
Dear {d.customer.firstName},
Thank you for your order. We will deliver {d.order.items} items to {d.customer.company} on {d.order.deliveryDate}.
Your account manager will contact you to confirm the delivery time.
Best regards,
{d.manager.name}
{d.manager.title}, Acme Corporation

Text of report.docx
Acme Corporation
500 Market Street, San Francisco, CA 94105
November 10, 2026
Emma Johnson
Bluebird Logistics
350 Fifth Avenue, Suite 4100 New York, NY 10118
Order confirmation SO-2026-0042
Dear Emma,
Thank you for your order. We will deliver 12 items to Bluebird Logistics on November 17, 2026.
Your account manager will contact you to confirm the delivery time.
Best regards,
Jane Smith
Account Manager, Acme Corporation
- Add
:convCRLFto keep the line breaks of a value, like the address:{d.customer.address:convCRLF}. - Turn off smart quotes in Word (AutoCorrect > AutoFormat As You Type). Formatters need straight quotes, like
:formatD('LL'). Learn more
Learn more about tags.
Loops
A loop repeats a table row for each item of an array. The template needs two rows:
- The row to repeat, with
[i]in its tags:{d.items[i].name}. - The next row, with
[i+1]in one cell:{d.items[i+1].name}. It marks the end of the loop and is removed from the report.
Carbone copies the row with its formatting and moves the content below it down, like the total.
{
"invoice": { "number": "INV-2026-0042", "date": "November 10, 2026", "due": "December 10, 2026" },
"customer": { "company": "Bluebird Logistics", "email": "billing@bluebird.example" },
"items": [
{ "name": "Laptop Pro 14", "qty": 4, "price": 1899, "amount": 7596 },
{ "name": "27-inch monitor", "qty": 4, "price": 349, "amount": 1396 },
{ "name": "USB-C dock", "qty": 4, "price": 189, "amount": 756 },
{ "name": "Wireless keyboard", "qty": 4, "price": 79, "amount": 316 },
{ "name": "Setup and onboarding", "qty": 1, "price": 450, "amount": 450 }
],
"total": 10514
}
Text of template.docx
Invoice
Invoice number
{d.invoice.number}
Date of issue
{d.invoice.date}
Date due
{d.invoice.due}
Acme Corporation
500 Market Street
San Francisco, CA 94105
Bill to
{d.customer.company}
{d.customer.email}
Description
Qty
Unit price
Amount
{d.items[i].name}
{d.items[i].qty}
{d.items[i].price:formatC}
{d.items[i].amount:formatC}
{d.items[i+1].name}
Total
{d.total:formatC}

Text of report.docx
Invoice
Invoice number
INV-2026-0042
Date of issue
November 10, 2026
Date due
December 10, 2026
Acme Corporation
500 Market Street
San Francisco, CA 94105
Bill to
Bluebird Logistics
billing@bluebird.example
Description
Qty
Unit price
Amount
Laptop Pro 14
4
$1,899.00
$7,596.00
27-inch monitor
4
$349.00
$1,396.00
USB-C dock
4
$189.00
$756.00
Wireless keyboard
4
$79.00
$316.00
Setup and onboarding
1
$450.00
$450.00
Total
$10,514.00
Sort and filter
Add an attribute before i to sort the items: {d.items[sku, i].sku} sorts the products by SKU, and the end tag becomes [sku+1, i+1]. Add a condition to the [i+1] tag to filter them: type!='service' removes the services from the packing slip. Learn more about sorting and filtering.
{
"order": { "number": "SO-2026-0042", "shipDate": "November 12, 2026", "carrier": "UPS Ground" },
"shipTo": { "company": "Bluebird Logistics", "address": "350 Fifth Avenue, Suite 4100, New York, NY 10118" },
"items": [
{ "sku": "LAP-14-SLV", "name": "Laptop Pro 14", "type": "product", "qty": 4 },
{ "sku": "SRV-SETUP", "name": "Setup and onboarding", "type": "service", "qty": 1 },
{ "sku": "MON-27-4K", "name": "27-inch monitor", "type": "product", "qty": 4 },
{ "sku": "ACC-DOCK-C", "name": "USB-C dock", "type": "product", "qty": 4 },
{ "sku": "SRV-WARR-3", "name": "Extended warranty, 3 years", "type": "service", "qty": 4 },
{ "sku": "ACC-KB-W", "name": "Wireless keyboard", "type": "product", "qty": 4 }
]
}
Text of template.docx
Packing slip
Order
{d.order.number}
Ship date
{d.order.shipDate}
Carrier
{d.order.carrier}
Ship to
{d.shipTo.company}
{d.shipTo.address}
SKU
Product
Qty
{d.items[sku, i].sku}
{d.items[sku, i].name}
{d.items[sku, i].qty}
{d.items[sku+1, i+1, type!='service'].name}

Text of report.docx
Packing slip
Order
SO-2026-0042
Ship date
November 12, 2026
Carrier
UPS Ground
Ship to
Bluebird Logistics
350 Fifth Avenue, Suite 4100, New York, NY 10118
SKU
Product
Qty
ACC-DOCK-C
USB-C dock
4
ACC-KB-W
Wireless keyboard
4
LAP-14-SLV
Laptop Pro 14
4
MON-27-4K
27-inch monitor
4
Nested loops
A loop repeats the part of the document between its [i] and [i+1] tags. Here, it repeats a heading and its table for each category. {d.categories[i].items[i].name} repeats the items of each category, and the {d.categories[i+1].name} paragraph closes the category loop.
{
"quote": { "number": "Q-2026-0187", "date": "November 10, 2026", "validUntil": "December 10, 2026" },
"categories": [
{
"name": "Hardware",
"subtotal": 9748,
"items": [
{ "name": "Laptop Pro 14 (x4)", "amount": 7596 },
{ "name": "27-inch monitor (x4)", "amount": 1396 },
{ "name": "USB-C dock (x4)", "amount": 756 }
]
},
{
"name": "Services",
"subtotal": 1246,
"items": [
{ "name": "Setup and onboarding", "amount": 450 },
{ "name": "Extended warranty, 3 years (x4)", "amount": 796 }
]
}
],
"total": 10994
}
Text of template.docx
Quote
Quote number
{d.quote.number}
Date
{d.quote.date}
Valid until
{d.quote.validUntil}
{d.categories[i].name}
Item
Amount
{d.categories[i].items[i].name}
{d.categories[i].items[i].amount:formatC}
{d.categories[i].items[i+1].name}
Subtotal
{d.categories[i].subtotal:formatC}
{d.categories[i+1].name}
Total
{d.total:formatC}

Text of report.docx
Quote
Quote number
Q-2026-0187
Date
November 10, 2026
Valid until
December 10, 2026
Hardware
Item
Amount
Laptop Pro 14 (x4)
$7,596.00
27-inch monitor (x4)
$1,396.00
USB-C dock (x4)
$756.00
Subtotal
$9,748.00
Services
Item
Amount
Setup and onboarding
$450.00
Extended warranty, 3 years (x4)
$796.00
Subtotal
$1,246.00
Total
$10,994.00
Table inside a table
Insert a table in a cell to repeat a list inside another list. Here, the outer table has one row per brand, and the table in its second cell has one row per model. Each loop closes on the row below it: {d.brands[i+1].name} for the brands and {d.brands[i].models[i+1]} for the models.
{
"brands": [
{
"name": "Aster Motors",
"models": [
{
"name": "Aster Nova",
"sales": 1016000
},
{
"name": "Aster Terra",
"sales": 842500
},
{
"name": "Aster Volt",
"sales": 417300
}
]
},
{
"name": "Borealis",
"models": [
{
"name": "Borealis Drift",
"sales": 934200
},
{
"name": "Borealis Ridge",
"sales": 611800
},
{
"name": "Borealis Pulse",
"sales": 288900
}
]
},
{
"name": "Cedar Auto",
"models": [
{
"name": "Cedar Lumen",
"sales": 725400
},
{
"name": "Cedar Haven",
"sales": 503100
},
{
"name": "Cedar Spark",
"sales": 349600
}
]
},
{
"name": "Dune Mobility",
"models": [
{
"name": "Dune Atlas",
"sales": 598700
},
{
"name": "Dune Mirage",
"sales": 412200
},
{
"name": "Dune Zephyr",
"sales": 196400
}
]
}
]
}
Text of template.docx
Best-selling vehicles
Units sold in 2025, by brand and model
Brand
Model
Units sold
{d.brands[i].name}
{d.brands[i].models[i].name}
{d.brands[i].models[i].sales:formatN(0)}
{d.brands[i].models[i+1]}
{d.brands[i+1].name}

Text of report.docx
Best-selling vehicles
Units sold in 2025, by brand and model
Brand
Model
Units sold
Aster Motors
Aster Nova
1,016,000
Aster Terra
842,500
Aster Volt
417,300
Borealis
Borealis Drift
934,200
Borealis Ridge
611,800
Borealis Pulse
288,900
Cedar Auto
Cedar Lumen
725,400
Cedar Haven
503,100
Cedar Spark
349,600
Dune Mobility
Dune Atlas
598,700
Dune Mirage
412,200
Dune Zephyr
196,400
Lists
Loops repeat paragraphs too. Write the [i] and [i+1] tags in two consecutive items of a bulleted or numbered list. Word numbers the generated items. deliverables is an array of strings, so the tag has no attribute: {d.deliverables[i]}.
{
"project": { "name": "Workplace refresh", "client": "Bluebird Logistics", "start": "December 1, 2026" },
"deliverables": [
"40 laptops imaged and enrolled in device management",
"Docking stations and monitors installed at each desk",
"Onboarding session for 40 employees",
"Asset inventory delivered as a spreadsheet"
],
"milestones": [
{ "name": "Kick-off meeting", "date": "December 1" },
{ "name": "Hardware delivery", "date": "December 8" },
{ "name": "Installation and training", "date": "December 10" },
{ "name": "Acceptance", "date": "December 15" }
]
}
Text of template.docx
Statement of work
Project
{d.project.name}
Client
{d.project.client}
Start date
{d.project.start}
Deliverables
{d.deliverables[i]}
{d.deliverables[i+1]}
Milestones
{d.milestones[i].name} {d.milestones[i].date}
{d.milestones[i+1].name}

Text of report.docx
Statement of work
Project
Workplace refresh
Client
Bluebird Logistics
Start date
December 1, 2026
Deliverables
40 laptops imaged and enrolled in device management
Docking stations and monitors installed at each desk
Onboarding session for 40 employees
Asset inventory delivered as a spreadsheet
Milestones
Kick-off meeting December 1
Hardware delivery December 8
Installation and training December 10
Acceptance December 15
Horizontal loops
Write the [i] and [i+1] tags in two adjacent columns to repeat columns instead of rows. Each row needs its own [i+1] tag, like {d.plans[i+1]}. Learn more about horizontal loops.
{
"plans": [
{ "name": "Starter", "price": 29, "users": "5", "storage": "100 GB", "support": "Email" },
{ "name": "Business", "price": 99, "users": "25", "storage": "1 TB", "support": "Email and chat" },
{ "name": "Enterprise", "price": 299, "users": "Unlimited", "storage": "10 TB", "support": "24/7 phone" }
]
}
Text of template.docx
Plan comparison
Prices per month, billed annually.
{d.plans[i].name}
{d.plans[i+1].name}
Price
{d.plans[i].price:formatC(0)}
{d.plans[i+1]}
Users
{d.plans[i].users}
{d.plans[i+1]}
Storage
{d.plans[i].storage}
{d.plans[i+1]}
Support
{d.plans[i].support}
{d.plans[i+1]}

Text of report.docx
Plan comparison
Prices per month, billed annually.
Starter
Business
Enterprise
Price
$29
$99
$299
Users
5
25
Unlimited
Storage
100 GB
1 TB
10 TB
Support
Email and chat
24/7 phone
Each generated column takes the width of the [i] column. Size it for the number of columns in your data.
Pages
Repeat a whole page to generate one page per item, like certificates, letters or payslips. Write the first [i] tag in the first paragraph of the page. Then set Page break before on this paragraph (Paragraph > Line and Page Breaks).
{
"course": { "name": "Advanced device management", "date": "November 6, 2026", "hours": 14 },
"attendees": [
{ "number": "C-2026-0107", "name": "Emma Johnson", "company": "Bluebird Logistics" },
{ "number": "C-2026-0108", "name": "Lucas Martin", "company": "Bluebird Logistics" }
]
}
Text of template.docx
Acme Corporation No. {d.attendees[i].number}
Certificate of completion
{d.attendees[i].name}
{d.attendees[i].company}
has completed the training
{d.course.name}
{d.course.hours} hours, completed on {d.course.date}
Jane Smith
Training Director, Acme Corporation
{d.attendees[i+1].name}


Text of report.docx
Acme Corporation No. C-2026-0107
Certificate of completion
Emma Johnson
Bluebird Logistics
has completed the training
Advanced device management
14 hours, completed on November 6, 2026
Jane Smith
Training Director, Acme Corporation
Acme Corporation No. C-2026-0108
Certificate of completion
Lucas Martin
Bluebird Logistics
has completed the training
Advanced device management
14 hours, completed on November 6, 2026
Jane Smith
Training Director, Acme Corporation
The loop starts at the paragraph that contains the first [i] tag. The paragraphs above it are printed once.
Different first page
To give the first page its own layout, like a podium of the top three beside a picture, split the list into two tables separated by a page break. Both tables loop on the same list, filtered on the index of the item.
- In the first table, keep the first three items:
{d[i,i<3].name}, and{d[i+1,i<3]}to end the loop. Indexes start at 0. - In the table after the page break, take the others:
{d[i,i>2].name}, and{d[i+1,i>2]}.
[
{
"rank": 1,
"name": "Brightline Partners",
"revenue": 4820000,
"products": [
"Laptop Pro 14",
"27-inch monitor",
"USB-C dock"
]
},
{
"rank": 2,
"name": "Kestrel Digital",
"revenue": 4310000,
"products": [
"Laptop Pro 14",
"Cloud backup",
"Office license"
]
},
{
"rank": 3,
"name": "Maple & Finch",
"revenue": 3975000,
"products": [
"27-inch monitor",
"Wireless keyboard",
"USB-C dock"
]
},
{
"rank": 4,
"name": "Orbit Solutions",
"revenue": 3420000,
"products": [
"Device management",
"Laptop Pro 14",
"Antivirus"
]
},
{
"rank": 5,
"name": "Lumen Retail",
"revenue": 3105000,
"products": [
"Wireless keyboard",
"Headset",
"USB-C dock"
]
},
{
"rank": 6,
"name": "Granite Networks",
"revenue": 2890000,
"products": [
"Cloud backup",
"Office license",
"Training"
]
},
{
"rank": 7,
"name": "Silverpine Tech",
"revenue": 2455000,
"products": [
"27-inch monitor",
"Laptop Pro 14",
"Warranty"
]
},
{
"rank": 8,
"name": "Harbor IT",
"revenue": 2210000,
"products": [
"Device management",
"Antivirus",
"Cloud backup"
]
},
{
"rank": 9,
"name": "Cobalt Commerce",
"revenue": 1980000,
"products": [
"Wireless keyboard",
"Headset",
"Office license"
]
},
{
"rank": 10,
"name": "Juniper Works",
"revenue": 1745000,
"products": [
"USB-C dock",
"27-inch monitor",
"Training"
]
},
{
"rank": 11,
"name": "Redwood Supply",
"revenue": 1520000,
"products": [
"Headset",
"Wireless keyboard",
"Warranty"
]
},
{
"rank": 12,
"name": "Tidewater Systems",
"revenue": 1295000,
"products": [
"Laptop Pro 14",
"Cloud backup",
"Antivirus"
]
}
]

Text of template.docx
[Picture: Cover picture]
Sales ranking 2026
Top resellers
Revenue in 2026, in US dollars
{d[i,i<3].rank} {d[i,i<3].name}
{d[i,i<3].revenue:formatC(0)}
Top products: {d[i,i<3].products:arrayJoin(', ')}
{d[i+1,i<3]}
Other resellers
Rank
Reseller
Revenue
{d[i,i>2].rank}
{d[i,i>2].name}
{d[i,i>2].products:arrayJoin(', ')}
{d[i,i>2].revenue:formatC(0)}
{d[i+1,i>2]}


Text of report.docx
[Picture: Cover picture]
Sales ranking 2026
Top resellers
Revenue in 2026, in US dollars
1 Brightline Partners
$4,820,000
Top products: Laptop Pro 14, 27-inch monitor, USB-C dock
2 Kestrel Digital
$4,310,000
Top products: Laptop Pro 14, Cloud backup, Office license
3 Maple & Finch
$3,975,000
Top products: 27-inch monitor, Wireless keyboard, USB-C dock
Other resellers
Rank
Reseller
Revenue
4
Orbit Solutions
Device management, Laptop Pro 14, Antivirus
$3,420,000
5
Lumen Retail
Wireless keyboard, Headset, USB-C dock
$3,105,000
6
Granite Networks
Cloud backup, Office license, Training
$2,890,000
7
Silverpine Tech
27-inch monitor, Laptop Pro 14, Warranty
$2,455,000
8
Harbor IT
Device management, Antivirus, Cloud backup
$2,210,000
9
Cobalt Commerce
Wireless keyboard, Headset, Office license
$1,980,000
10
Juniper Works
USB-C dock, 27-inch monitor, Training
$1,745,000
11
Redwood Supply
Headset, Wireless keyboard, Warranty
$1,520,000
12
Tidewater Systems
Laptop Pro 14, Cloud backup, Antivirus
$1,295,000
Learn more about filters.
Repeat the header row
To repeat the column titles of a long table on each page, select its first row and check Repeat as header row at the top of each page (Table Properties > Row). Uncheck Allow row to break across pages to keep each row on one page. Word applies both settings to the generated rows. Learn more about pagination.
{
"project": {
"name": "Maple Street house",
"client": "Bluebird Residences"
},
"steps": [
{
"id": 1,
"name": "Site survey and soil study",
"team": "Surveyor",
"days": 5
},
{
"id": 2,
"name": "Building permit",
"team": "Architect",
"days": 21
},
{
"id": 3,
"name": "Site clearing",
"team": "Groundworks",
"days": 3
},
{
"id": 4,
"name": "Excavation",
"team": "Groundworks",
"days": 4
},
{
"id": 5,
"name": "Foundation footings",
"team": "Masonry",
"days": 6
},
{
"id": 6,
"name": "Concrete slab",
"team": "Masonry",
"days": 4
},
{
"id": 7,
"name": "Underground plumbing",
"team": "Plumber",
"days": 3
},
{
"id": 8,
"name": "Foundation walls",
"team": "Masonry",
"days": 7
},
{
"id": 9,
"name": "Waterproofing",
"team": "Masonry",
"days": 2
},
{
"id": 10,
"name": "Backfill and compaction",
"team": "Groundworks",
"days": 2
},
{
"id": 11,
"name": "Floor framing",
"team": "Carpenter",
"days": 5
},
{
"id": 12,
"name": "Wall framing",
"team": "Carpenter",
"days": 9
},
{
"id": 13,
"name": "Roof trusses",
"team": "Carpenter",
"days": 4
},
{
"id": 14,
"name": "Roof sheathing",
"team": "Roofer",
"days": 3
},
{
"id": 15,
"name": "Windows and exterior doors",
"team": "Carpenter",
"days": 3
},
{
"id": 16,
"name": "Roof covering",
"team": "Roofer",
"days": 5
},
{
"id": 17,
"name": "Exterior wall insulation",
"team": "Insulation",
"days": 4
},
{
"id": 18,
"name": "Rough electrical",
"team": "Electrician",
"days": 6
},
{
"id": 19,
"name": "Rough plumbing",
"team": "Plumber",
"days": 5
},
{
"id": 20,
"name": "Heating and ventilation",
"team": "HVAC",
"days": 6
},
{
"id": 21,
"name": "Framing inspection",
"team": "Inspector",
"days": 1
},
{
"id": 22,
"name": "Interior insulation",
"team": "Insulation",
"days": 3
},
{
"id": 23,
"name": "Drywall hanging",
"team": "Drywall",
"days": 6
},
{
"id": 24,
"name": "Drywall finishing",
"team": "Drywall",
"days": 5
},
{
"id": 25,
"name": "Exterior siding",
"team": "Siding",
"days": 8
},
{
"id": 26,
"name": "Interior painting",
"team": "Painter",
"days": 6
},
{
"id": 27,
"name": "Flooring",
"team": "Flooring",
"days": 7
},
{
"id": 28,
"name": "Kitchen cabinets",
"team": "Carpenter",
"days": 4
},
{
"id": 29,
"name": "Countertops",
"team": "Stonework",
"days": 2
},
{
"id": 30,
"name": "Interior doors and trim",
"team": "Carpenter",
"days": 5
},
{
"id": 31,
"name": "Finish electrical",
"team": "Electrician",
"days": 3
},
{
"id": 32,
"name": "Finish plumbing",
"team": "Plumber",
"days": 3
},
{
"id": 33,
"name": "Appliances",
"team": "Installer",
"days": 2
},
{
"id": 34,
"name": "Exterior painting",
"team": "Painter",
"days": 4
},
{
"id": 35,
"name": "Landscaping",
"team": "Landscaper",
"days": 6
},
{
"id": 36,
"name": "Final inspection",
"team": "Inspector",
"days": 1
},
{
"id": 37,
"name": "Cleaning",
"team": "Cleaner",
"days": 2
},
{
"id": 38,
"name": "Handover",
"team": "Project manager",
"days": 1
}
]
}
Text of template.docx
Construction schedule
{d.project.name}, {d.project.client}
Step
Task
Team
Days
{d.steps[i].id}
{d.steps[i].name}
{d.steps[i].team}
{d.steps[i].days}
{d.steps[i+1].id}


Text of report.docx
Construction schedule
Maple Street house, Bluebird Residences
Step
Task
Team
Days
1
Site survey and soil study
Surveyor
5
2
Building permit
Architect
21
3
Site clearing
Groundworks
3
4
Excavation
Groundworks
4
5
Foundation footings
Masonry
6
6
Concrete slab
Masonry
4
7
Underground plumbing
Plumber
3
8
Foundation walls
Masonry
7
9
Waterproofing
Masonry
2
10
Backfill and compaction
Groundworks
2
11
Floor framing
Carpenter
5
12
Wall framing
Carpenter
9
13
Roof trusses
Carpenter
4
14
Roof sheathing
Roofer
3
15
Windows and exterior doors
Carpenter
3
16
Roof covering
Roofer
5
17
Exterior wall insulation
Insulation
4
18
Rough electrical
Electrician
6
19
Rough plumbing
Plumber
5
20
Heating and ventilation
HVAC
6
21
Framing inspection
Inspector
1
22
Interior insulation
Insulation
3
23
Drywall hanging
Drywall
6
24
Drywall finishing
Drywall
5
25
Exterior siding
Siding
8
26
Interior painting
Painter
6
27
Flooring
Flooring
7
28
Kitchen cabinets
Carpenter
4
29
Countertops
Stonework
2
30
Interior doors and trim
Carpenter
5
31
Finish electrical
Electrician
3
32
Finish plumbing
Plumber
3
33
Appliances
Installer
2
34
Exterior painting
Painter
4
35
Landscaping
Landscaper
6
36
Final inspection
Inspector
1
37
Cleaning
Cleaner
2
38
Handover
Project manager
1
Numbers and dates
Formatters print numbers, amounts and dates in the language of the report. This example uses "lang": "en-us".
:formatCprints currencies, and:formatC(L, acc)prints accounting amounts, like ($120.00).:toWord(C)writes an amount in words, for checks and contracts.:formatN(1)prints a number with one decimal, and:formatD('LL')prints a date.
{
"receipt": "RCT-2026-0318",
"paidAt": "2026-11-10",
"method": "Bank transfer",
"amount": 1234.5,
"lateFee": 1.5,
"balance": -120
}
Text of template.docx
Payment receipt
Acme Corporation, 500 Market Street, San Francisco, CA 94105
Receipt number
{d.receipt}
Payment date
{d.paidAt:formatD('LL')}
Payment method
{d.method}
Amount paid
{d.amount:formatC}
In words
{d.amount:toWord(C):ucFirst}
Late fee
{d.lateFee:formatN(1)}% per month
Account balance
{d.balance:formatC(L, acc)}

Text of report.docx
Payment receipt
Acme Corporation, 500 Market Street, San Francisco, CA 94105
Receipt number
RCT-2026-0318
Payment date
November 10, 2026
Payment method
Bank transfer
Amount paid
$1,234.50
In words
One thousand two hundred thirty-four dollars and fifty cents
Late fee
1.5% per month
Account balance
($120.00)
See the number, currency and date formatters.
Conditions
Conditions print a value or remove an element, depending on the data:
- Inline conditions print one value or another:
{d.order.paid:ifEQ(true):show('Paid'):elseShow('Payment due')}, or a checkbox withshow('☒'):elseShow('☐'). - Smart conditions remove the element that contains their tag:
{d.discount:ifEQ(0):drop(row)}removes the discount row, and{d.note:ifEM:drop(p)}removes the paragraph of an empty note.
{
"order": { "number": "SO-2026-0042", "paid": false, "due": "December 10, 2026" },
"options": { "warranty": true, "installation": false, "recycling": true },
"subtotal": 10514,
"discount": 0,
"total": 10514,
"note": ""
}
Text of template.docx
Order summary
Order {d.order.number} · {d.order.paid:ifEQ(true):show('Paid'):elseShow('Payment due')}
Options
{d.options.warranty:ifEQ(true):show('☒'):elseShow('☐')} Extended warranty, 3 years
{d.options.installation:ifEQ(true):show('☒'):elseShow('☐')} On-site installation
{d.options.recycling:ifEQ(true):show('☒'):elseShow('☐')} Recycling of old devices
Subtotal
{d.subtotal:formatC}
Discount {d.discount:ifEQ(0):drop(row)}
-{d.discount:formatC}
Total
{d.total:formatC}
Please pay before {d.order.due}.{d.order.paid:ifEQ(true):drop(p)}
Note: {d.note}{d.note:ifEM:drop(p)}

Text of report.docx
Order summary
Order SO-2026-0042 · Payment due
Options
☒ Extended warranty, 3 years
☐ On-site installation
☒ Recycling of old devices
Subtotal
$10,514.00
Total
$10,514.00
Please pay before December 10, 2026.
:drop also removes a table (table), a picture (img) or a chart (chart). Add a count to remove several paragraphs or rows: :drop(p, 3) removes the paragraph of the tag and the next two. Learn more about inline conditions and smart conditions.
Conditional blocks
Write :showBegin and :showEnd around several paragraphs to print them only when a condition is true, like the clauses of a contract. Write the begin tag at the end of the paragraph above the block, and the end tag at the end of the last paragraph of the block. When the condition is false, the block is removed without leaving an empty paragraph, and Word renumbers the clauses.
{
"customer": { "company": "Bluebird Logistics", "region": "US" },
"plan": "Enterprise",
"fee": 2490,
"start": "December 1, 2026"
}
Text of template.docx
Service agreement
Between Acme Corporation and {d.customer.company}, starting {d.start}.
Services
Acme Corporation provides the {d.plan} plan: device management, monitoring and updates of the devices of the customer.
Fees
The customer pays {d.fee:formatC} per month, invoiced at the beginning of each month.{d.plan:ifEQ('Enterprise'):showBegin}
Premium support
A dedicated engineer answers within one hour, 24/7, by phone and chat.{d.plan:showEnd}{d.customer.region:ifEQ('EU'):showBegin}
Data processing
Personal data is processed in the European Union, under the Data Processing Addendum of Acme Corporation.{d.customer.region:showEnd}
Term
The agreement lasts 12 months and renews automatically, unless terminated with 30 days notice.

Text of report.docx
Service agreement
Between Acme Corporation and Bluebird Logistics, starting December 1, 2026.
Services
Acme Corporation provides the Enterprise plan: device management, monitoring and updates of the devices of the customer.
Fees
The customer pays $2,490.00 per month, invoiced at the beginning of each month.
Premium support
A dedicated engineer answers within one hour, 24/7, by phone and chat.
Term
The agreement lasts 12 months and renews automatically, unless terminated with 30 days notice.
A begin tag at the start of a paragraph leaves an empty paragraph in the report. :hideBegin and :hideEnd work the same way. Learn more about conditional blocks.
Remove columns
:drop(col) removes the table column that contains its tag. Write it in one cell of the column: {d.hasDiscount:ifEQ(false):drop(col)} removes the discount column when no item has a discount.
{
"quote": "Q-2026-0188",
"hasDiscount": false,
"items": [
{ "name": "Laptop Pro 14", "qty": 4, "discount": 0, "amount": 7596 },
{ "name": "27-inch monitor", "qty": 4, "discount": 0, "amount": 1396 },
{ "name": "USB-C dock", "qty": 4, "discount": 0, "amount": 756 }
]
}
Text of template.docx
Quote
Quote {d.quote}
Item
Qty
Discount
Amount
{d.items[i].name}
{d.items[i].qty}
{d.items[i].discount}%{d.hasDiscount:ifEQ(false):drop(col)}
{d.items[i].amount:formatC}
{d.items[i+1].name}

Text of report.docx
Quote
Quote Q-2026-0188
Item
Qty
Amount
Laptop Pro 14
4
$7,596.00
27-inch monitor
4
$1,396.00
USB-C dock
4
$756.00
Columns with merged cells cannot be removed. Learn more about removing columns.
Totals
Math formatters compute a value for each row: {d.items[i].qty:mul(.price)} multiplies the quantity by the price of the item. Aggregators compute a value for the whole array: {d.items[].qty:mul(.price):aggSum} sums the row amounts. Store a result with :set to reuse it, like the subtotal used for the tax and the total.
{
"invoice": "INV-2026-0043",
"taxRate": 8.25,
"items": [
{ "name": "Laptop Pro 14", "qty": 4, "price": 1899 },
{ "name": "27-inch monitor", "qty": 4, "price": 349 },
{ "name": "USB-C dock", "qty": 4, "price": 189 },
{ "name": "Wireless keyboard", "qty": 4, "price": 79 }
]
}
Text of template.docx
Invoice
Invoice {d.invoice}
Description
Qty
Unit price
Amount
{d.items[i].name}
{d.items[i].qty}
{d.items[i].price:formatC}
{d.items[i].qty:mul(.price):formatC}
{d.items[i+1].name}
{d.items[].qty:mul(.price):aggSum:set(c.subtotal)} {c.subtotal:mul(d.taxRate):div(100):set(c.tax)} {c.subtotal:add(c.tax):set(c.total)}
Subtotal
{c.subtotal:formatC}
Tax ({d.taxRate}%)
{c.tax:formatC}
Total
{c.total:formatC}

Text of report.docx
Invoice
Invoice INV-2026-0043
Description
Qty
Unit price
Amount
Laptop Pro 14
4
$1,899.00
$7,596.00
27-inch monitor
4
$349.00
$1,396.00
USB-C dock
4
$189.00
$756.00
Wireless keyboard
4
$79.00
$316.00
Subtotal
$10,064.00
Tax (8.25%)
$830.28
Total
$10,894.28
A :set tag prints nothing. Write it above the tags that read its value. Learn more about math formatters, aggregators and :set.
Colors
:color applies a color from the data. {d.invoices[i].color:color(p)} colors the text of the status, and {d.invoices[i].background:color(row, background)} colors the background of the overdue row. Use cell to color a single table cell.
{
"customer": "Bluebird Logistics",
"date": "November 10, 2026",
"invoices": [
{
"number": "INV-2026-0031",
"due": "October 10, 2026",
"status": "Overdue",
"amount": 2140,
"color": "#C0123C",
"background": "#FDF2F4"
},
{
"number": "INV-2026-0036",
"due": "November 5, 2026",
"status": "Paid",
"amount": 4380,
"color": "#1F8A5B",
"background": "#FFFFFF"
},
{
"number": "INV-2026-0042",
"due": "December 10, 2026",
"status": "Due",
"amount": 10514,
"color": "#B54708",
"background": "#FFFFFF"
},
{
"number": "INV-2026-0043",
"due": "December 10, 2026",
"status": "Due",
"amount": 10894.28,
"color": "#B54708",
"background": "#FFFFFF"
}
]
}
Text of template.docx
Account statement
{d.customer}, {d.date}
Invoice
Due date
Status
Amount
{d.invoices[i].number}{d.invoices[i].background:color(row, background)}
{d.invoices[i].due}
{d.invoices[i].status}{d.invoices[i].color:color(p)}
{d.invoices[i].amount:formatC}
{d.invoices[i+1].number}

Text of report.docx
Account statement
Bluebird Logistics, November 10, 2026
Invoice
Due date
Status
Amount
INV-2026-0031
October 10, 2026
Overdue
$2,140.00
INV-2026-0036
November 5, 2026
Paid
$4,380.00
INV-2026-0042
December 10, 2026
Due
$10,514.00
INV-2026-0043
December 10, 2026
Due
$10,894.28
The color is a 6-digit hex code, like #C0123C. Apply a font color to the text in the template. Carbone replaces it with the color from the data. Learn more about colors.
Pictures
Insert a temporary picture and write the tag in its alt text (right-click > Edit Alt Text), like {d.logo}. Carbone replaces it with the image from the data, given as a public URL or a Base64 data URI. In a table row, the loop repeats the picture, like the photo of each product.
{
"logo": "https://carbone.io/img/doc/docx-acme-logo.png",
"quote": "Q-2026-0189",
"items": [
{
"name": "Laptop Pro 14",
"description": "M-series chip, 16 GB memory, 512 GB SSD",
"price": 1899,
"photo": "https://carbone.io/img/doc/docx-product-laptop.png"
},
{
"name": "27-inch monitor",
"description": "4K display, USB-C with 90 W charging",
"price": 349,
"photo": "https://carbone.io/img/doc/docx-product-monitor.png"
},
{
"name": "USB-C dock",
"description": "Two displays, Ethernet, five USB ports",
"price": 189,
"photo": "https://carbone.io/img/doc/docx-product-dock.png"
},
{
"name": "Wireless keyboard",
"description": "Backlit keys, three paired devices",
"price": 79,
"photo": "https://carbone.io/img/doc/docx-product-keyboard.png"
}
]
}
Text of template.docx
[Picture: {d.logo}]
Quote
{d.quote}
Product
Price
[Picture: {d.items[i].photo:imageFit(contain)}]
{d.items[i].name}
{d.items[i].description}
{d.items[i].price:formatC}
{d.items[i+1].name}

Text of report.docx
[Picture]
Quote
Q-2026-0189
Product
Price
[Picture]
Laptop Pro 14
M-series chip, 16 GB memory, 512 GB SSD
$1,899.00
[Picture]
27-inch monitor
4K display, USB-C with 90 W charging
$349.00
[Picture]
USB-C dock
Two displays, Ethernet, five USB ports
$189.00
[Picture]
Wireless keyboard
Backlit keys, three paired devices
$79.00
- Set the temporary picture to In Line with Text (Wrap Text). A floating picture is replaced, but a loop does not repeat it.
- The image takes the width of the temporary picture and keeps its own proportions.
:imageFit(contain)fits it inside the temporary picture, like the product photos. :autoOrientrotates photos taken with a phone, based on their orientation metadata.
Learn more about pictures.
Barcodes
Barcodes are pictures too: write the :barcode formatter in the alt text of a temporary picture. {d.tracking:barcode(code128, scale:4)} draws the tracking number, and {d.trackingUrl:barcode(qrcode, scale:4)} draws a QR code of the tracking page.
{
"order": "SO-2026-0042",
"weight": "18.4 lb",
"shipTo": { "company": "Bluebird Logistics", "address": "350 Fifth Avenue, Suite 4100\nNew York, NY 10118" },
"tracking": "1Z999AA10123456784",
"trackingUrl": "https://carbone.io/documentation/design/template-formats/docx.html"
}
Text of template.docx
Shipping label
Order {d.order}, {d.weight}
From
Acme Corporation
500 Market Street
San Francisco, CA 94105
Ship to
{d.shipTo.company}
{d.shipTo.address:convCRLF}
Tracking number
[Picture: {d.tracking:barcode(code128, scale:4)}]
Track online
[Picture: {d.trackingUrl:barcode(qrcode, scale:4)}]

Text of report.docx
Shipping label
Order SO-2026-0042, 18.4 lb
From
Acme Corporation
500 Market Street
San Francisco, CA 94105
Ship to
Bluebird Logistics
350 Fifth Avenue, Suite 4100 New York, NY 10118
Tracking number
[Picture]
Track online
[Picture]
The barcode takes the width of the temporary picture. scale sets the resolution, from 1 to 10 (3 by default). Learn more about the barcode types and options.
Charts
Insert a chart in Word (Insert > Chart) and write the tags in its data sheet (right-click > Edit Data). Write {d.months[i].name} and {d.months[i].revenue} on row 2, under the header row, and {d.months[i+1].name} and {d.months[i+1].revenue} on row 3. Each column needs its [i+1] cell. Carbone fills the chart with all the items and keeps its type, colors and labels.
{
"period": "July to December 2026",
"total": 1298050,
"months": [
{ "name": "Jul", "revenue": 182400 },
{ "name": "Aug", "revenue": 196750 },
{ "name": "Sep", "revenue": 204300 },
{ "name": "Oct", "revenue": 221900 },
{ "name": "Nov", "revenue": 238600 },
{ "name": "Dec", "revenue": 254100 }
]
}
Text of template.docx
Revenue report
{d.period}
Total revenue
{d.total:formatC(0)}
Revenue by month

Text of report.docx
Revenue report
July to December 2026
Total revenue
$1,298,050
Revenue by month
In the template, Word shows the tags as empty categories. To draw a chart image from the data instead, use the :chart formatter.
HTML
:html renders HTML from a web editor or a CRM as Word formatting: paragraphs, bold, italic, links and lists. By default, the HTML starts a new paragraph. Add (inline) to keep it in the paragraph of its tag, like {d.note:html(inline)}.
{
"proposal": { "title": "Workplace refresh", "client": "Bluebird Logistics" },
"scope": "<p>Acme Corporation replaces the laptops of the <b>New York office</b> in two phases:</p><ul><li><b>Phase 1</b>: imaging and enrollment of 40 laptops</li><li><b>Phase 2</b>: delivery and installation at each desk</li></ul><p>Every device is covered by the <i>3-year extended warranty</i>. Read the <a href=\"https://carbone.io/documentation/design/advanced-features/html.html\">deployment plan</a>.</p>"
}
Text of template.docx
Proposal
{d.proposal.title} for {d.proposal.client}
Scope of work
{d.scope:html}

Text of report.docx
Proposal
Workplace refresh for Bluebird Logistics
Scope of work
Acme Corporation replaces the laptops of the New York office in two phases:
Phase 1: imaging and enrollment of 40 laptops
Phase 2: delivery and installation at each desk
Every device is covered by the 3-year extended warranty. Read the deployment plan.
PRE-RELEASE v5.11.0+ Add {o.preReleaseFeatureIn=5011000} to the template to render the tables, headings, page breaks and quotes of the HTML. Without it, their text is printed without formatting. Learn more
Hyperlinks
Select some text, insert a link (Insert > Link) and write a tag as its address, like {d.paymentUrl} for the payment button. In a loop, each row gets the address of its item: {d.items[i].url}.
{
"invoice": "INV-2026-0044",
"total": 2488,
"paymentUrl": "https://carbone.io/documentation/design/advanced-features/hyperlinks.html",
"items": [
{
"name": "Laptop Pro 14",
"url": "https://carbone.io/documentation/design/template-formats/docx.html",
"amount": 1899
},
{
"name": "USB-C dock",
"url": "https://carbone.io/documentation/design/template-formats/xlsx.html",
"amount": 189
},
{
"name": "Noise-cancelling headset",
"url": "https://carbone.io/documentation/design/advanced-features/pictures.html",
"amount": 400
}
]
}
Text of template.docx
Invoice
Invoice {d.invoice}
Product
Amount
{d.items[i].name}
{d.items[i].amount:formatC}
{d.items[i+1].name}
Total
{d.total:formatC}
Pay this invoice online

Text of report.docx
Invoice
Invoice INV-2026-0044
Product
Amount
Laptop Pro 14
$1,899.00
USB-C dock
$189.00
Noise-cancelling headset
$400.00
Total
$2,488.00
Pay this invoice online
Carbone checks each address and replaces an invalid one with a default address. Set your own with :defaultURL. Learn more about dynamic hyperlinks.
Translations
Write static text in {t( )} tags, and add the :t formatter to translate values from the data. Carbone uses the translations for the lang of the report. This example uses "lang": "fr-fr" and the dictionary in the Translations tab. Dates and amounts follow the language too.
{
"invoice": { "number": "INV-2026-0045", "date": "2026-11-10" },
"customer": "Maison Lefèvre",
"items": [
{ "name": "Laptop Pro 14", "qty": 2, "amount": 3798 },
{ "name": "Setup and onboarding", "qty": 1, "amount": 450 },
{ "name": "Extended warranty, 3 years", "qty": 2, "amount": 398 }
],
"total": 4646
}{
"fr-fr": {
"Invoice": "Facture",
"Invoice number": "Numéro de facture",
"Date of issue": "Date d’émission",
"Description": "Désignation",
"Qty": "Qté",
"Amount": "Montant",
"Total": "Total",
"Setup and onboarding": "Installation et prise en main",
"Extended warranty, 3 years": "Garantie étendue, 3 ans",
"Thank you for your business.": "Merci pour votre confiance."
}
}
Text of template.docx
{t(Invoice)}
{d.customer}
{t(Invoice number)}
{d.invoice.number}
{t(Date of issue)}
{d.invoice.date:formatD('LL')}
{t(Description)}
{t(Qty)}
{t(Amount)}
{d.items[i].name:t}
{d.items[i].qty}
{d.items[i].amount:formatC}
{d.items[i+1].name}
{t(Total)}
{d.total:formatC}
{t(Thank you for your business.)}

Text of report.docx
Facture
Maison Lefèvre
Numéro de facture
INV-2026-0045
Date d’émission
10 novembre 2026
Désignation
Qté
Montant
Laptop Pro 14
2
3 798,00 €
Installation et prise en main
1
450,00 €
Garantie étendue, 3 ans
2
398,00 €
Total
4 646,00 €
Merci pour votre confiance.
Write the text of a {t( )} tag without quotes: {t(Invoice)}. Learn more about translations.
Headers and footers
Tags work in headers and footers, like the statement number. Insert page numbers with Word (Insert > Page Number, or the PAGE and NUMPAGES fields). They are computed on each page of the report. To repeat the first row of a table on each page, see Repeat the header row.
{
"statement": { "number": "ST-2026-10", "period": "October 2026" },
"customer": "Bluebird Logistics",
"entries": [
{ "date": "2026-10-01", "description": "Payment received, INV-2026-0029", "amount": 6250 },
{ "date": "2026-10-02", "description": "Laptop Pro 14 (x2)", "amount": -3798 },
{ "date": "2026-10-03", "description": "Cloud backup, monthly plan", "amount": -60 },
{ "date": "2026-10-05", "description": "27-inch monitor (x2)", "amount": -698 },
{ "date": "2026-10-06", "description": "USB-C dock (x2)", "amount": -378 },
{ "date": "2026-10-07", "description": "Payment received, INV-2026-0030", "amount": 4380 },
{ "date": "2026-10-08", "description": "Wireless keyboard (x6)", "amount": -474 },
{ "date": "2026-10-09", "description": "Setup and onboarding", "amount": -450 },
{ "date": "2026-10-12", "description": "Noise-cancelling headset (x4)", "amount": -596 },
{ "date": "2026-10-13", "description": "Office license (x10)", "amount": -990 },
{ "date": "2026-10-14", "description": "Payment received, INV-2026-0031", "amount": 2140 },
{ "date": "2026-10-15", "description": "Device management, monthly plan", "amount": -240 },
{ "date": "2026-10-16", "description": "Laptop Pro 14 (x1)", "amount": -1899 },
{ "date": "2026-10-19", "description": "Extended warranty, 3 years (x3)", "amount": -597 },
{ "date": "2026-10-20", "description": "Payment received, INV-2026-0032", "amount": 5100 },
{ "date": "2026-10-21", "description": "27-inch monitor (x4)", "amount": -1396 },
{ "date": "2026-10-22", "description": "Training session", "amount": -300 },
{ "date": "2026-10-23", "description": "USB-C dock (x4)", "amount": -756 },
{ "date": "2026-10-26", "description": "Payment received, INV-2026-0033", "amount": 3200 },
{ "date": "2026-10-27", "description": "Wireless keyboard (x4)", "amount": -316 },
{ "date": "2026-10-27", "description": "Antivirus, annual plan (x10)", "amount": -450 },
{ "date": "2026-10-28", "description": "Laptop Pro 14 (x2)", "amount": -3798 },
{ "date": "2026-10-28", "description": "Payment received, INV-2026-0034", "amount": 2900 },
{ "date": "2026-10-29", "description": "Shipping and handling", "amount": -85 },
{ "date": "2026-10-29", "description": "Noise-cancelling headset (x2)", "amount": -298 },
{ "date": "2026-10-30", "description": "Maintenance", "amount": -120 },
{ "date": "2026-10-30", "description": "Payment received, INV-2026-0035", "amount": 1500 },
{ "date": "2026-10-31", "description": "Cloud backup, storage upgrade", "amount": -45 }
]
}
Text of template.docx
Account activity
{d.customer}, {d.statement.period}
Date
Description
Amount
{d.entries[i].date:formatD('ll')}
{d.entries[i].description}
{d.entries[i].amount:formatC(L, acc)}
{d.entries[i+1].date}


Text of report.docx
Account activity
Bluebird Logistics, October 2026
Date
Description
Amount
Oct 1, 2026
Payment received, INV-2026-0029
$6,250.00
Oct 2, 2026
Laptop Pro 14 (x2)
($3,798.00)
Oct 3, 2026
Cloud backup, monthly plan
($60.00)
Oct 5, 2026
27-inch monitor (x2)
($698.00)
Oct 6, 2026
USB-C dock (x2)
($378.00)
Oct 7, 2026
Payment received, INV-2026-0030
$4,380.00
Oct 8, 2026
Wireless keyboard (x6)
($474.00)
Oct 9, 2026
Setup and onboarding
($450.00)
Oct 12, 2026
Noise-cancelling headset (x4)
($596.00)
Oct 13, 2026
Office license (x10)
($990.00)
Oct 14, 2026
Payment received, INV-2026-0031
$2,140.00
Oct 15, 2026
Device management, monthly plan
($240.00)
Oct 16, 2026
Laptop Pro 14 (x1)
($1,899.00)
Oct 19, 2026
Extended warranty, 3 years (x3)
($597.00)
Oct 20, 2026
Payment received, INV-2026-0032
$5,100.00
Oct 21, 2026
27-inch monitor (x4)
($1,396.00)
Oct 22, 2026
Training session
($300.00)
Oct 23, 2026
USB-C dock (x4)
($756.00)
Oct 26, 2026
Payment received, INV-2026-0033
$3,200.00
Oct 27, 2026
Wireless keyboard (x4)
($316.00)
Oct 27, 2026
Antivirus, annual plan (x10)
($450.00)
Oct 28, 2026
Laptop Pro 14 (x2)
($3,798.00)
Oct 28, 2026
Payment received, INV-2026-0034
$2,900.00
Oct 29, 2026
Shipping and handling
($85.00)
Oct 29, 2026
Noise-cancelling headset (x2)
($298.00)
Oct 30, 2026
Maintenance
($120.00)
Oct 30, 2026
Payment received, INV-2026-0035
$1,500.00
Oct 31, 2026
Cloud backup, storage upgrade
($45.00)
To build chapters with a table of contents, see Chapters and table of contents. Learn more about pagination.
Chapters and table of contents
A Word table of contents follows the chapters that a loop generates, with their page numbers.
- Write the chapter title
{d.chapters[i].title}in a paragraph styled Heading 1, and its closing tag{d.chapters[i+1]}in a Heading 1 paragraph too. - Insert the table of contents above the loop (Insert > Field > TOC). Carbone adds one line per chapter and updates the page numbers.
- Number the chapters with a numbered list on the heading style.
- Number the sections with
:print(.i):add(1)for the chapter and:print(..i):add(1)for the section.:add(1)is needed because indexes start at 0.
{
"title": "Onboarding handbook",
"chapters": [
{
"title": "Getting started",
"sections": [
{
"title": "Accounts and access",
"text": "Your manager requests your accounts before day one. You receive an email with the first steps."
},
{
"title": "Equipment",
"text": "A laptop, a headset and a badge are waiting at your desk. Ask the office team for anything else."
},
{
"title": "First week",
"text": "Meet your team, read the product overview and complete the security training."
}
]
},
{
"title": "Working together",
"sections": [
{
"title": "Communication",
"text": "Use chat for quick questions and email for decisions that need a written record."
},
{
"title": "Meetings",
"text": "Every meeting has an agenda and notes. Decline meetings you do not need to attend."
},
{
"title": "Time off",
"text": "Request time off in the HR tool. Your manager answers within two working days."
}
]
},
{
"title": "Security",
"sections": [
{
"title": "Passwords",
"text": "Use the company password manager. Never reuse a password from another service."
},
{
"title": "Devices",
"text": "Lock your screen when you leave your desk and keep your system up to date."
},
{
"title": "Incidents",
"text": "Report any suspicious email or lost device to the security team right away."
}
]
},
{
"title": "Benefits",
"sections": [
{
"title": "Health insurance",
"text": "Your plan starts on your first day. Add your family from the HR tool within 30 days."
},
{
"title": "Meals",
"text": "Lunch vouchers are loaded on your card every month, on top of your salary."
},
{
"title": "Remote work",
"text": "Work from home up to three days a week, after agreeing on a schedule with your team."
}
]
},
{
"title": "Support",
"sections": [
{
"title": "Help desk",
"text": "Open a ticket from the portal. Urgent issues are answered within one hour."
},
{
"title": "Learning",
"text": "Each employee has a yearly training budget. Pick a course and ask for approval."
},
{
"title": "Feedback",
"text": "Share ideas in the monthly survey or directly with your manager at any time."
}
]
}
]
}

Text of template.docx
{d.title}
Contents
{d.chapters[i].title} 2
{d.chapters[i+1]} 2
{d.chapters[i].title}
{d.chapters[i].sections[i].title:print(.i):add(1)}.{d.chapters[i].sections[i].title:print(..i):add(1)}. {d.chapters[i].sections[i].title}
{d.chapters[i].sections[i].text}
{d.chapters[i].sections[i+1]}
{d.chapters[i+1]}



Text of report.docx
Onboarding handbook
Contents
1. Getting started 2
2. Working together 2
3. Security 2
4. Benefits 2
5. Support 3
Getting started
1.1. Accounts and access
Your manager requests your accounts before day one. You receive an email with the first steps.
1.2. Equipment
A laptop, a headset and a badge are waiting at your desk. Ask the office team for anything else.
1.3. First week
Meet your team, read the product overview and complete the security training.
Working together
2.1. Communication
Use chat for quick questions and email for decisions that need a written record.
2.2. Meetings
Every meeting has an agenda and notes. Decline meetings you do not need to attend.
2.3. Time off
Request time off in the HR tool. Your manager answers within two working days.
Security
3.1. Passwords
Use the company password manager. Never reuse a password from another service.
3.2. Devices
Lock your screen when you leave your desk and keep your system up to date.
3.3. Incidents
Report any suspicious email or lost device to the security team right away.
Benefits
4.1. Health insurance
Your plan starts on your first day. Add your family from the HR tool within 30 days.
4.2. Meals
Lunch vouchers are loaded on your card every month, on top of your salary.
4.3. Remote work
Work from home up to three days a week, after agreeing on a schedule with your team.
Support
5.1. Help desk
Open a ticket from the portal. Urgent issues are answered within one hour.
5.2. Learning
Each employee has a yearly training budget. Pick a course and ask for approval.
5.3. Feedback
Share ideas in the monthly survey or directly with your manager at any time.
Learn more about the table of contents and the loop iterator value.
Signatures
Write {d.signer:sign} where the signature goes, and put the name and email of the signer in the data. When the report is a PDF, the API response gives the position of each signature field, so you can send the document to your e-signature provider. Learn more about signatures.
Automate a DOCX file
Store the template once, then generate a DOCX file for each set of data. These commands use the files of the Loops example.
1. Upload the template. Carbone returns its template ID in data.id:
curl --request POST 'https://api.carbone.io/template' \
--header 'carbone-version: 5' \
--header 'Authorization: Bearer API_TOKEN' \
--form 'versioning=true' \
--form 'template=@loops-template.docx'
2. Generate the document with the template ID and the JSON data:
curl --request POST 'https://api.carbone.io/render/TEMPLATE_ID?download=true' \
--header 'carbone-version: 5' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer API_TOKEN' \
--data-raw "{ \"data\": $(cat loops-data.json) }" \
--output report.docx
Without convertTo, the report has the format of the template. To get a PDF, see Convert DOCX to PDF. Learn more about template storage.
Convert DOCX to PDF
To generate a PDF from a DOCX template with the Carbone API:
- Prepare two files: a DOCX template with Carbone tags, like
{d.name}, and the JSON data to populate it. You can use the files of the Loops example. - Generate the PDF in one of three ways:
- Use an official Carbone integration, like N8N, Make, Zapier, Airtable or Bubble.
- Use a Carbone SDK: Node.js, Go, Python, Java, JavaScript or PHP.
- Send a
POST /render/templateHTTP request to the Carbone API, like this curl command:
curl --location --request POST 'https://api.carbone.io/render/template?download=true' \
--header 'carbone-version: 5' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer API_TOKEN' \
--data-raw "{
\"data\": $(cat loops-data.json),
\"template\": \"$(base64 -i loops-template.docx)\",
\"lang\": \"en-us\",
\"convertTo\": \"pdf\"
}" \
--output report.pdf
💡 Linux users: replacebase64 -i loops-template.docxwithbase64 -w 0 loops-template.docx
Key parameters
| Parameter | Description |
|---|---|
template |
Your DOCX template, encoded as a Base64 string. |
data |
JSON data used to populate the template. |
lang |
Language of the report, used by the formatters and translations: "en-us" prints {d.total:formatC} as $10,514.00. |
convertTo |
"pdf", or another output format: "docx" (by default), "odt", "txt"... |
converter |
Optional: LibreOffice "L" (default), Carbone ICE "I" (the fastest for DOCX to PDF) or OnlyOffice "O". See converters. |
?download=true |
Query parameter to download the document as a stream. |
Authorization |
Header required for the Carbone Cloud API. Get your API key here. |
The fonts of the template must be available to the converter. See font support. For more details, refer to the Carbone API Documentation.