Creating a repeated section
Applies to JungleDocs for Office 365.
For a similar tutorial for JungleDocs for SharePoint 2010-2019, click here.
Repeated sections allow you to import multiple items from a list into a document template. Therefore, they are key to creating reports with JungleDocs for Office 365. Using repeated sections, you can import not only selected items, but also a filtered or unfiltered view, or a whole list. In this tutorial, you will learn how to create repeated sections in Word and Excel templates.
Creating a repeated section in Word templates
1. Create a table with at least two rows, select one row and add a Rich Text content control:
2. Click Properties.
3. In the Tag field, type ReportItems.
4. Select a cell inside the row governed by the ReportItems content control, and add another content control, containing the internal column name in the Tag field. Repeat this process for each cell of the row.
When you add such a template to a rule and run that rule, JungleDocs for Office 365 will copy the metadata from the selected items' Title, Date and Comments columns into the table. This template is not associated with any list or view, so it can be used to generate reports from any list that has the matching internal column names.
Creating a repeated section in Excel templates
There are two ways to insert a repeated section in Excel.
Method 1: inserting a comment
1. Add a comment to the top left cell of your repeated section region. In the comment, enter one of the following Repeater functions:
=Repeater(arg1; width; height)
The Repeater function has the following arguments:
- arg1 Required. Any function that returns a list of items from SharePoint.
- width Optional. The maximum number of sheet columns to be repeated. The default value is 0, meaning that all columns will be copied in a row to the right from the current cell. For example, setting the width to 1 will only allow one (the first one) column to be repeated.
- height Optional. The maximum number of sheet rows to be repeated. For example, setting the height to 2 will repeat 2 rows in the Excel sheet for every list entry in your SharePoint. The default value is 1.
GetView("List Name"; "View Name") – returns all items in your specified lists’ view.
FindItems("List Name"; "Column Name"; "Value") – returns all items from your specified list, that contain your specified value "Value" in your specified column "Column Name".
4. Apart from the Repeater() function, you need to also add additional commands for every SharePoint column that you want to be retrieved automatically. Use the following syntax:
In the example above, a repeated section is configured to have 6 columns and 1 row for every list item, starting from A1 cell. This section will repeat as many times as there are items in the AllItems view. In the A cells, item IDs are displayed. In the B cells, Title column values are displayed. In the C cells, Status column values are displayed.
To better understand how repeating works, take a look at the template below. Let's suppose that cells A1 and B1 are already configured to retrieve column values.
Now, if you inserted the following function in cell A1 and select 4 items in the SharePoint list:
this would be the result:
=Repeater(GetView("List"; "View"); 2; 1)
=Repeater(GetView("List"; "View"); 1; 2)
Note: JungleDocs for Office 365 does not currently support multiple repeated sections on the same Excel sheet.
Method 2: inserting a table
We could get the same result more easily by inserting a simple table within the Excel template.
1. Insert a table inside cell A1.
2. In the first content cell of the table, add the following comment: =Repeater(GetView("Tasks"; "AllItems")). Do not change the column title, JungleDocs for Office 365 will copy column titles from SharePoint automatically. The app will extend this table to contain all columns from the view and will create as many rows as it is necessary to fill with items from the view.