A child command of composeXLSXContent that iterates through all items of a Collection and produces as many worksheets as there are items in the collection.
Parent commands
-
composeXLSXContent
Required. Defines the Excel file that the repeatWorksheet command modifies.
Attributes
|
value |
|
|
|---|---|---|
|
Required |
Value type |
EL-evaluated |
|
Yes |
Collection, Map, Data Item |
Yes |
|
This attribute defines the container whose contents the command will iterate through. While this container is primarily expected to be a Collection, two other types of values are also accepted. The three types are handled in the following ways:
|
||
|
var |
|
|
|---|---|---|
|
Required |
Value type |
EL-evaluated |
|
Yes |
String |
No |
|
The value of this attribute defines the name of the local context variable that holds the current item of the loop. |
||
|
varStatus |
|
|
|---|---|---|
|
Required |
Value type |
EL-evaluated |
|
No |
String |
No |
|
Defines the name of the variable that holds a Loop Status value. Loop Status has the properties Property |
||
|
roundTest |
|
|
|---|---|---|
|
Required |
Value type |
EL-evaluated |
|
No |
Boolean |
Yes |
|
This attribute can be used to define a condition for skipping certain iteration rounds. This attribute's expression is evaluated at the start of every round and if it doesn't resolve into If undefined, no iteration rounds are skipped. |
||
|
worksheet |
|
|
|---|---|---|
|
Required |
Value type |
EL-evaluated |
|
Yes |
String, Number |
No |
|
Defines the worksheet that will be repeated. Value can be the sheet name (String) or index (Number, first sheet is 1). |
||
|
sheetName |
|
|
|---|---|---|
|
Required |
Value type |
EL-evaluated |
|
Yes |
String, Number |
No |
|
Defines the name of the produced sheet - evaluated separately for every iterated item, so it can use expressions with the “var” in it. If not defined, the repeated sheets will have the name of the original repeated sheet with a number suffix. |
||
The repeatWorksheet command can be used to create Excel files with multiple worksheets based on the amount of records in related lists, custom SOQL queries, custom collections within the template.
This is especially useful for product data sheets and significantly reduces manual data input.
In the sample below (image and source), repeatWorksheet is used to create one worksheet per each item in 'oppLineItems' (collection produced from relatedList):
<xlex:composeXLSXContent var="file" template="${file}" title="${documentTitle}" customProperties="${properties}">
<xlex:repeatWorksheet value="${oppLineItems}"
var="oppLineItem"
worksheet="1"
sheetName="${sheetStatusVar.getCount()}"
varStatus="sheetStatusVar"
roundTest="${oppLineItem.showProduct == true}" />
</xlex:composeXLSXContent>
Resulting in an Excel with as many sheets as there are items in the Collection: