|
Dynamically adding sections (cloning)This topic explains how to clone a section in a Control Script, Print sections can be cloned, so that a document can have a dynamic number of sections, based on data. This is particularly useful when the record set defines one or more PDFs (e.g. insurance policies) per recipient. Via a Control Script, for each PDF a section can be cloned and each clone can be given one of the PDFs as background (see Control Script: Setting a Print section's background). For each page in the PDF, a page will be added to the section. For information about Control Scripts in general, see Control Scripts and Control Script API. If you don't know how to write scripts, see Writing your own scripts. Cloning a sectionTo clone a section, first use the
Cloned sections have the same properties as normal sections, but they cannot call Due to resource constraints, the number of clones that can be created is limited to 60.
Renaming a cloneBy default, clones receive the name of their source section with a "Clone {sequence}" suffix, for example: Use the
Note that section names must be unique. Targeting elements in a cloned sectionAs each clone receives a unique section name, one could use CSS style sheets (see Styling and formatting) and personalization scripts (see Variable Data and Writing your own scripts) to further personalize the cloned sections. The following CSS style rules target the <h1> element in a number of clones and assigns the respective text a different color:
The same selectors could be used in personalization scripts: Selector: In a template script, cloned sections can be found using
Note that in a Control Script, ExamplesCloning a section based on the number of records in a detail tableThis script creates as many clones of a section as there are records in a detail table. It assigns the new sections a unique name.
Cloning a section based on data and assigning a background PDFThis script clones a section based on data fields. It disables the source section first and then calls the
|
|