JungleDocs | Repeater section in Excel documents
Just like in Word it is possible to use JungleDocs to add repeater sections into Excel sheets. In this tutorial you will learn how to do this
To get your repeater section working in Excel there are a couple of configurations you will need to set. Let's get started.
1. To begin, add a Repeater comment to the top left cell of your repeater region.
2. Command available syntaxes are:
- =Repeater(arg1; width; height)
- =Repeater(arg1; width)
- arg1 – command that returns a list of items, it should be a command that links your Excel template to specific data fields in your SharePoint sites.
Currently available commands for arg1:
- GetView("List Name"; "View Name") – this will return all items in your specified lists’ view.
- FindItems("List Name"; "Column Name"; "Value") – this will return all items from your specified list, that contain your specified value "Value" in your specified column "Column Name".
- width – optional width parameter – maximum number of columns repeater has to repeat. By default its value is 0. It means – all columns will be copied in a row to the right from current cell. For example, setting width to 1 will only allow one (the first one) column to be repeated.
- height – optional height parameter – it means, how many rows repeater has to repeat. For example setting height to 2, will repeat 2 rows in the Excel sheet for every list entry in your SharePoint. By default its value is 1.
3. Inside the repeater region you can specify additional tags from repeater context. One comment can contain multiple commands. Add additional tags for columns that you need to be reapeated.
4. If you want to copy list items’ values to your Excel sheet, you have to add a Repeater() command and add additional commands for every column you need to be copied:
In this example, it will repeat a region with width of 6 columns, and 1 row for every list item, starting from A1 cell. It will repeat as many times, as many items the function GetView("Tasks"; "AllItems") will return. In each top cell, A1, A2, etc., we will put repeated items’ IDs. In the lower cells, B1, B2, etc., we will put repeated items’ column names, for example Title.
Note: JungleDocs does not currently support multiple repeaters (matrix tables) on the same Excel sheet.
We could get the same result more easily by using a simple table.
- Insert a table:
- In the first content cell of the table, add the following comment: =Repeater(GetView("Tasks"; "AllItems")). Do not change the column title, JungleDocs will copy column titles from SharePoint automatically. JungleDocs 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.