Formatting Rule Fields

The Formatting Rule field type enables a field to create content based on a stored Formatting Rule:

When the field is inserted, the named rule is populated and inserted between text markers without any tags (tags within tags are not allowed). When Repeat For Each Line is enabled, the rule will be populated once for each line in the field content and the content of the field changed to only contain that data for that line for the duration of the population.

Checking for Updates

In contrast to text links, where the content of the document is compared to the data, checking if an update is needed is handled differently. It would be too slow to re-render to entire content each time, so the links are tagged using the content of the original field and any named Fields.  The field is only marked as needing an update if these change, or the Formatting Rule is updated.

Simple Example

A typical use would be a field containing a list of icons, where each icon should be displayed along with its name. For example:

On updates, any icons added or removed will be reflected in the document. This uses the Formatting Rule shown here:

The fields Picture Options point to the folder containing the images and the picture frame is tagged with the field. There’s also a text box with a field specifier, which is also populated.

Complex Example

In this example, the field contains a several names combined with an RGB value for the corresponding swatch:

The complexity is that Formatting Rule needs to break each line down into name and swatch. The swatch frame is given a Script Label so it can be identified – color. Post Processing on the Formatting Rule breaks out the color code part into an RGB swatch, finds the named frame and applies it:

The label should be just the name part, so we embed this logic into there:

Inserting that field now results in:

 

Whitespace Handling

When Strip Whitespace is enabled in the alphanumeric field options, any trailing returns are truncated from the field.