You are on the Xporter Cloud documentation. If you are looking for Xporter Server documentation, you can find it in this page.

In this exercise, you'll learn how to export details of images.

We are going to use the notation that allows you to define which sections of the template will be populated for each issue, and which sections will be static:

&{for issues}

Use a Conditional Block #{if...} to indicate whether to iterate or not.

Put the mapping ${Key} to indicate which issues are being populated. 

If the issue doesn't have images, you can display a message instead.

#{if (%{'${ImagesCount}' == 0})}
Doesn't have Images.
#{end}

If the issue has images, you can set the message to display the number of images, along with the image Iteration.

#{if (%{'${ImagesCount}' > 0})}
There are ${ImagesCount} images.

In this case, you don't close the mapping #{end} because we are going to do an iteration before closing the conditional block.

Below it, put the #{for images} or #{for <VariableName>=ImagesCount} statement.

Put the mapping to display an image with max width and max height.

${Images[n].Image|maxwidth=100|maxheight=100}

You can customize the maxwidth and the maxheight.

Now, create a table where the details of the image will be populated:

Name${Images[n].Name}
HumanReadableSize${Images[n].HumanReadableSize}
CreatedDateTime${dateformat("dd-MM-yyyy HH:mm:ss")Images[n].Created}
MimeType${Images[n].MimeType}

For a list of fields to be populated when iterating images, check here.

Finally, close the two statements using the mapping #{end}.

You can also put a conditional block to print only the image that you want. We are going to do an iteration again of #{for images} or #{for <VariableName>=ImagesCount} statement.

Below it, use a conditional block:

#{if (%{"${Images[n].Name}".equals("xporter.png")})}

With the conditional block count that you have defined above, enter if the conditional block is true.

In this example, we attached an image named xporter.png. Don't forget to attach images to your issue.

We are going to put the mapping to display an image with maxwidth and maxheight, so the mapping is ${Images[n].Image|maxwidth=100|maxheight=100}

Close the two statement using the mapping #{end}.

Finally, close the &{for issues} that you opened at the beginning, using the mapping &{end}.

Below is a sample of how the mappings will be displayed in a Word template:

This Template has:

  • A header with an image
  • Headings
  • Text styling
  • Table

Below is a sample of how the generated file will be populated:

Congratulations! You passed the Intermediate level (smile) Proceed to the next level.

If you like this exercise, please leave a comment or a (thumbs up). Your feedback is very important to us.

Thank you in advance.

Enjoy our product. (big grin)

Here are the files related to this Exercise:

FileDescription
Exercise 7 - Template

Exercise 7 - Sample Template file

Exercise 7 - GeneratedExercise 7 - Sample generated file
  • No labels