---
title: "DOCX/PPTX Template"
description: "EMILY.RPA DOCX/PPTX Template module: apply dynamic content to a document template to generate DOCX or PPTX files."
source: https://docs.emily.tips/en/wap/docxtemplate
---

# DOCX/PPTX Template

Apply dynamic content to a specified document template file to generate DOCX/PPTX documents.

![](https://docs.emily.tips/img/en/wap-191.png)

## Parameters

**`DOCX/PPTX TEAMPLTE`** - The DOCX/PPTX template file used to generate dynamic content. Click "**PICK**" to select or use the **%FILENAME%** variable.

![Template document](https://docs.emily.tips/img/en/wap-192.png)

![Output document](https://docs.emily.tips/img/en/wap-193.png)

## No-Code Editor

Provides no-code commands such as "**Text Template**", "**Array Template**", and "**Image Template**". For example, add array data to the `Array Template`.

![](https://docs.emily.tips/img/en/wap-194.png)

## Low-Code Editor

![](https://docs.emily.tips/img/en/wap-195.png)

**`Text Template`** - Replace template variables with strings. For example, replace `%title%` with `Product Details`.

**`Array Template`** - Replace template variables with JSON array content. If an array template is inserted into a table, the table will automatically add rows based on the array data length. If you want automatic line breaks in text, add a line break before the array ending variable. For example, `%#products%` `%name%` `%amount%` `%price%` `%/products%` is replaced with the following array:
```
[
  {
    "name": "Coffee",
    "amount": 10,
    "price": 100
  },
  {
    "name": "Black Tea",
    "amount": 5,
    "price": 80
  }
]
```

**`Image Template`** - Replace template variables with PNG images. For example, replace `%img.chart1%` with the `chart1.png` image.

### input Object

Each key in the input object is the name of a TXT file in the working folder (without extension), and each value is the text content of that file.

```javascript
// Read the values of title.txt and products.txt in the working folder
let title = input['title']
console.log('title:', title)

let products = JSON.parse(input['products'])
console.log('products:', products)
```

### output Object

Corresponding to the variable %key% in the DOCX/PPTX template file content, the output object must specify the value for output\['key']. Corresponding to the array variable %items% in the DOCX template file content, the output object must specify a data array as the value for output\['items']:

```javascript
// The DOCX template file defines %title% and %#products% %name% %amount% %price% %/products%
output['title'] = title
output['products'] = products

// Insert a PNG file from the working folder
output['img.logo'] = 'logo.png'
```
