---
title: "Exercise 6 - Exporting Charts"
canonical: "https://docs.getxporter.app/space/XPORTERCLOUD/527966/Exercise%206%20-%20Exporting%20Charts"
format: markdown
---
> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (toc)

# Introduction

In this exercise, you will use a Word template (DOCX) to export data into charts within the document.

This document will iterate over multiple Issues ([Bulk export](https://docs.getxporter.app/space/XPORTERCLOUD/428193/Static+Sections+for+Bulk+Export)), exporting some basic information and a chart based on *Number Type Custom Fields* for each Issue.

While iterating over all Issues, you will update some [Template](https://docs.getxporter.app/space/XPORTERCLOUD/427622) variables (with the Set function), which will be used to export a final chart at the end of the document.

# Exporting Charts with Word Templates

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> [Create a cover page](https://docs.getxporter.app/space/XPORTERCLOUD/429879/Exercise+4+-+Populating+a+Word+Template#Introduction) and insert a Table of Contents (TOC).
> 
> > Macro (rw-step)
> 
> Add the title - *Issues* - with the Heading 1 style (to be used with TOC) and below it add the following Set functions:
> 
> ```
> ${set(issueTypeBug,0)}
> 
> ${set(issueTypeStory,0)}
> 
> ${set(issueTypeSubTestExec,0)}
> 
> ${set(issueTypeEpic,0)}
> 
> ${set(statusOpen,0)}
> 
> ${set(statusResolved,0)}
> 
> ${set(statusClosed,0)}
> 
> ${set(statusInProgress,0)}
> ```
> 
> These variables will be used to populate the final chart.
> 
> > Macro (rw-step)
> 
> Start iterating Issues with `&{for issues}`
> 
> > Macro (rw-step)
> 
> Export some basic information like the Issue *Key* and *Summary*.
> 
> > Macro (rw-step)
> 
> Insert a chart.
> 
> > ℹ️ Currently, Microsoft Word charts aren't supported by [Xporter for Jira Cloud](https://marketplace.atlassian.com/apps/891368/xporter-export-issues-from-jira?tab=overview&hosting=cloud). To export charts on a Microsoft Word template, you have to use [OLE (Object Linking and Embedding)](https://learn.microsoft.com/en-us/cpp/mfc/ole-background-linking-and-embedding?view=msvc-170) with an Excel chart.
> 
> To insert the Microsoft Excel chart:
> 
> 1. Insert.
> 2. Object.
> 3. Microsoft Excel chart.
> 
> > Macro (rw-step)
> 
> Double-click the newly inserted chart to edit it.
> 
> > Macro (rw-step)
> 
> Populate the chart with three values: *AttachmentsCount*, *CommentsCount*, and *LinksCount*.
> 
> > Macro (rw-step)
> 
> Right-click the chart and choose *Select Data*. You'll be transferred to the sheet with the data.
> 
> > Macro (rw-step)
> 
> Select the range from A1 to D2. Delete all other data and change the selected range as follows:
> 
> |  | **A** | **B** | **C** | **D** |
> | --- | --- | --- | --- | --- |
> | **1** |  | AttachmentsCount | CommentsCount | LinksCount |
> | **2** | ${Key} | ${AttachmentsCount} | ${CommentsCount} | ${LinksCount} |
> 
> > Macro (rw-step)
> 
> Now, update the previously defined variables using the ones below. You will increment each Issue type and status depending on the Issue context that is being exported.
> 
> ```
> #{if (%{'${IssueTypeName}' == 'Bug'})}
> 
> ${set(issueTypeBug,%{${issueTypeBug} + 1})}
> 
> #{end}
> 
> #{if (%{'${IssueTypeName}' == 'Story'})}
> 
> ${set(issueTypeStory,%{${issueTypeStory} + 1})}
> 
> #{end}
> 
> #{if (%{'${IssueTypeName}' == 'Sub Test Execution'})}
> 
> ${set(issueTypeSubTestExec,%{${issueTypeSubTestExec} + 1})}
> 
> #{end}
> 
> #{if (%{'${IssueTypeName}' == 'Epic'})}
> 
> ${set(issueTypeEpic,%{${issueTypeEpic} + 1})}
> 
> #{end}
> 
> #{if (%{'${Status}' == 'Open'})}
> 
> ${set(statusOpen,%{${statusOpen} + 1})}
> 
> #{end}
> 
> #{if (%{'${Status}' == 'In Progress'})}
> 
> ${set(statusInProgress,%{${statusInProgress} + 1})}
> 
> #{end}
> 
> #{if (%{'${Status}' == 'Resolved'})}
> 
> ${set(statusResolved,%{${statusResolved} + 1})}
> 
> #{end}
> 
> #{if (%{'${Status}' == 'Closed'})}
> 
> ${set(statusClosed,%{${statusClosed} + 1})}
> 
> #{end}
> ```
> 
> 
> > Macro (rw-step)
> 
> Close the Issue's iteration with `&{end}`
> 
> > Macro (rw-step)
> 
> Add two final charts with the totals of the Issue types and Issue statuses.
> 
> > Macro (rw-step)
> 
> Add a title - *Totals* - with the Heading 1 style.
> 
> > Macro (rw-step)
> 
> Insert two charts as before, with the following data:
> 
> |  | **A** | **B** | **C** | **D** | **E** |
> | --- | --- | --- | --- | --- | --- |
> | **1** |  | Bug | Story | Sub Test Execution | Epic |
> | **2** | Issue Types | ${issueTypeBug} | ${issueTypeStory} | ${issueTypeSubTestExec} | ${issueTypeEpic} |
> 
> 
> |  | **A** | **B** | **C** | **D** | **E** |
> | --- | --- | --- | --- | --- | --- |
> | **1** |  | Open | In Progress | Resolved | Closed |
> | **2** | Issue Statuses | ${statusOpen} | ${statusInProgress} | ${statusResolved} | ${statusClosed} |
> 
> ## Examples
> 
> Below (Figure 1) there is a sample of how the [mappings](https://docs.getxporter.app/space/XPORTERCLOUD/558575) will be displayed in a Word template.
> 
> ![Figure 1 - Word template](media://5bcba518-0fd2-40c0-98f3-c783054f8448)
> 
> Below (Figure 2) there is a sample of how the generated file will be populated.
> 
> ![Figure 2 - Populated file](media://b40e3dc9-3606-4dbc-a983-754a81ec1728)
> 
> > ℹ️ [More examples of charts in Word templates](https://docs.getxporter.app/space/XPORTERCLOUD/460426)

> ℹ️ **This exercise is now complete. Proceed to **[**Exercise 7**](https://docs.getxporter.app/space/XPORTERCLOUD/527867/Exercise+7+-+Project+overview+by+month+(issues+count+by+month)+using+macros+on+an+Excel)** to learn h****ow**<span style="color: #111111">** to populate the Issue time taking from some issues with pivot tables on an Xporter-generated file.**</span>
> ℹ️ 
> ℹ️ If you like this exercise, please share your opinion on the page by just leaving a comment or a 👍. Your opinion is very important to us.
> ℹ️ 
> ℹ️ Thank you in advance. Enjoy our product!

<details>
<summary>Exercise 6 Resources</summary>

| **File** | **Description** |
| --- | --- |
|  | Exercise 6 - Sample template file |
|  | Exercise 6 - Sample generated file |
</details>


<details>
<summary>Support/Troubleshooting</summary>

If you have questions or technical issues, please [contact the Support team via the Customer Portal (Jira service management)](https://jira.getxray.app/servicedesk/customer/portal/2/user/login?destination=portal%2F2%2Fcreate%2F28) or [send us a message using the in-app chat](https://docs.getxporter.app/space/XPORTERCLOUD/18251779/In-App+Chat+Support).
</details>