---
title: "Exercise 6 - Export Charts with Word Templates"
canonical: "https://docs.getxporter.app/space/XPORTER/1409362/Exercise%206%20-%20Export%20Charts%20with%20Word%20Templates"
format: markdown
---
In this exercise, you will use a Word Template (DOCX) to export data into charts within the document.

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> [Create a cover page](https://support.microsoft.com/en-us/office/add-a-cover-page-79df80ec-266d-46d6-9382-6d70f1d13777) and insert a Table of Contents (TOC). This document will iterate [multiple Issues](https://docs.getxporter.app/space/XPORTER/1412803) (Bulk export), exporting some basic information and a chart based on the Number Type Custom Fields for each Issue. While iterating all Issues, you'll update some [Template](https://docs.getxporter.app/space/XPORTER/1412105) variables (with the [Set function](https://docs.getxporter.app/space/XPORTER/1413854/Functions#Set)), which will be used to export a final chart at the end of the document.
> 
> > Macro (rw-step)
> 
> Insert a title "Issues" with style Heading 1 (to be used with the TOC) and below it add these Set functions:
> 
> |  |
> | --- |
> | ${set(issueTypeBug,0)}<br>${set(issueTypeStory,0)}<br>${set(issueTypeSubTestExec,0)}<br>${set(issueTypeEpic,0)}<br>${set(statusOpen,0)}<br>${set(statusResolved,0)}<br>${set(statusClosed,0)}<br>${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's Key and Summary.
> 
> > Macro (rw-step)
> 
> [Insert a chart](https://support.microsoft.com/en-us/office/add-a-chart-to-your-document-in-word-ff48e3eb-5e04-4368-a39e-20df7c798932).
> 
> > ℹ️ Microsoft Word Charts aren't supported by Xporter for Jira. To export charts on a Microsoft Word template, you have to use an [Object Linking and Embedding](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-oleds/85583d21-c1cf-4afe-a35f-d6701c5fbb6f) Microsoft Excel Chart.
> 
> To [insert the Microsoft Excel Chart](https://support.microsoft.com/en-us/office/create-a-chart-from-start-to-finish-0baf399e-dd61-4e18-8a73-b3fd5d5680c2), on the top menu, go to *Insert* → *Object* → *Microsoft Excel Chart*.
> 
> Double-click the newly inserted chart to edit it.
> 
> Populate the chart with three values: `AttachmentsCount`, `CommentsCount` and `LinksCount`.
> 
> Right-click the chart and choose *Select Data*. You'll be transferred to the sheet with the data. 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)
> 
> Update the previously defined variables. Increment each Issue type and status depending on the Issue context being exported.
> 
> |  |
> | --- |
> | #{if (%{'${IssueTypeName}' == 'Bug'})}<br>${set(issueTypeBug,%{${issueTypeBug} + 1})}<br>#{end}<br>#{if (%{'${IssueTypeName}' == 'Story'})}<br>${set(issueTypeStory,%{${issueTypeStory} + 1})}<br>#{end}<br>#{if (%{'${IssueTypeName}' == 'Sub Test Execution'})}<br>${set(issueTypeSubTestExec,%{${issueTypeSubTestExec} + 1})}<br>#{end}<br>#{if (%{'${IssueTypeName}' == 'Epic'})}<br>${set(issueTypeEpic,%{${issueTypeEpic} + 1})}<br>#{end}<br>#{if (%{'${Status}' == 'Open'})}<br>${set(statusOpen,%{${statusOpen} + 1})}<br>#{end}<br>#{if (%{'${Status}' == 'In Progress'})}<br>${set(statusInProgress,%{${statusInProgress} + 1})}<br>#{end}<br>#{if (%{'${Status}' == 'Resolved'})}<br>${set(statusResolved,%{${statusResolved} + 1})}<br>#{end}<br>#{if (%{'${Status}' == 'Closed'})}<br>${set(statusClosed,%{${statusClosed} + 1})}<br>#{end} |
> 
> > Macro (rw-step)
> 
> Close the Issues iteration with `&{end}`
> 
> > Macro (rw-step)
> 
> Add two final charts with the totals of Issue types and Issue statuses.
> 
> > Macro (rw-step)
> 
> Add a title "Totals" with style Heading 1. 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/XPORTER/1413922) will be displayed in a Word Template:
> 
> ![Figure 1 - Template](media://663d4a5f-5d8b-4550-af9a-654472106a60)
> 
> Below (Figure 2) there is a sample of how the generated file will be populated:
> 
> ![Figure 2 - Template](media://27392dad-e6f6-4335-b9eb-8044f5e2820a)
> 
> > ℹ️ [More examples](https://create.microsoft.com/en-us/templates/charts) of Microsoft Word chart templates.

> ℹ️ **Exercise 6 is now complete. Proceed to **[**Exercise **](https://docs.getxporter.app/space/XPORTER/1413502)[**7**](https://docs.getxporter.app/space/XPORTER/1415479/Exercise+7+-+Project+overview+by+month+(it+counts+the+issues+by+month)+using+macros+on+an+Excel)** to learn more about a Project overview by month using macros on an Excel Template.**
> ℹ️ 
> ℹ️ If you like this exercise, please [write us and leave a comment](https://docs.getxporter.app/space/XPORTERCLOUD/460118/Support) or a 👍. Your feedback is very important to us.
> ℹ️ 
> ℹ️ Thank you in advance. Enjoy our product!

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

| **File** | **Description** |
| --- | --- |
|  | Sample Template file |
|  | 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/XPORTER/23102936).
</details>