XML Styles are another way of creating Styles, similar to Classic Styles but using XML. Some features, such as validation of data to be organized in certain formats such as phone numbers, can only be done using XML Styles. Below are some instructions for common XML style codes.
Font formatting:
Text color:
Pantone color: <style fillcolor="Pantone Reflex Blue CV 1.0" >Here some text</style>
CMYK color:
<style fillcolor=0.1 0.3 0.4 0>Here some text</style>
<style fillcolor=cmyk 0.1 0.3 0.4 0>Here some text</style>
Font size: <style fontsize=14>Here some text</style>
Group multiple settings: <style fontname="Times-Roman" fillcolor="0 0 0 1" fillcolor="Pantone Reflex Blue CV 1.0">Here some text</style>
<input name="field_name"/>
or <input name="field_name" type="singleline"/>
<input name="field_name" type="multiline"/>
Hidden field (fields that have no input widget). This is usefull for widgets that only get a computed value.
This can be accomplished for any input field by specifying the attribute hidden="true"
:
<input name="field_name" type="singleline" hidden="true"/>
<input name="field_name" type="multiline" hidden="true"/>
<input name="field_name" type="multiline">
<process type="replace" pattern="\\n" new=" " />
<process type="replace" pattern="\\t" new="	" />
</input>
<input name="field_name" type="multiline">
<process type="split" separator="\\n" />
</input>
<input name="agent.Notes.$1" type="multiline" hidden="true"/> <input name="agent.Notes.$2" type="multiline" hidden="true"/> <input name="agent.Notes.$3" type="multiline" hidden="true"/>
<input name="field_name" type="multiline">
<process type="uppercase"/>
</input>
<input name="field_name_2" type="multiline">
<process type="lowercase"/>
</input>
<input name="field_name" type="multiline">
<process type="uppercase"/>
<process type="replace" pattern="-" new=""/>
</input>
<input name="field_name" type="multiline">
<process type="replace" pattern="[^0-9]+" new=""/>
</input>
In certain cases, you will want to allow your customers to personalize a small section of text found within a larger body of paragraph text, but you do not want to allow your customer to modify the text of the other parts of the paragraph. This personalized text will be inserted into the middle of the paragraph and the full paragraph text will flow according the “Textflow” or "Textline" controls set in the block.
To allow user to change only part of the text, you'll need to define the insertion points, define the label that appears for user and define the default text, if any. The code looks like this:
<input name="field_name"/>
or <input name="field_name" type="singleline"/>
Code inserted into your style could look like this:
My favorite fruit is .
In this case, "My favorite fruit is" is static and the user can only change the fruit name itself. The period ending the sentence would move to accommodate the fruit name entered by user.
In the Designer, the field using this Style would look like this when clicked on by the user:
You can also create XML styles for multiline inline fields, and hidden fields, as you see below:
<input name="field_name" type="multiline"/>
Hidden field (fields that have no input widget). This is useful for widgets that only get a computed value.
Usually during personalization, user can type any text they wish into the box. In some cases, you may want to force customers to select from a limited set of options. By creating a dropdown field, the customers must choose from the options presented in this dropdown. These options are pre-populated in the style and user simply selects from the dropdown without having to type into the field. The populated text will flow according the “Textflow” or "Textline" controls set in the block.
To create a dropdown for user to select from, you'll need to define the dropdown, define the label that appears for user and define the options user can choose. The code looks like this:
Read only content format:
<input name="choose address" type="dropdown">
<option value="New York">Hardrock Cafe<nextline/>1200 5th Ave.<nextline/>New York, NY 10019</option>
<option value="Chicago">Hardrock Cafe<nextline/>100 Michigan Ave.<nextline>Chicago, IL 60609</option>
<option value="Hollywood">Hardrock Cafe<nextline/>629 Sunset Blvd.<nextline/>Hollywood, CA 91114</option>
</input>
Editable content format:
<input name="choose address" type="dropdown" editable="true">
<option value="New York">Hardrock Cafe<nextline/>1200 5th Ave.<nextline/>New York, NY 10019</option>
<option value="Chicago">Hardrock Cafe<nextline/>100 Michigan Ave.<nextline>Chicago, IL 60609</option>
<option value="Hollywood">Hardrock Cafe<nextline/>629 Sunset Blvd.<nextline/>Hollywood, CA 91114</option>
</input>
The XML style above will generate a dropdown field in the Designer interface with choices "New York", "Chicago" and "Los Angeles" shown to the user. The text of the full address is inserted into the document:
In order to use this function your block Type must be set to Textflow
In certain cases, you may want certain text in a paragraph to be displayed with different font styling than the surrounding text.
In order to use this function your block Type must be set to Textflow.
The code for font formatting is as follows:
Font formatting:
Text color:
Pantone color: <style fillcolor="Pantone Reflex Blue CV 1.0" >Here some text</style>
CMYK color:
<style fillcolor=0.1 0.3 0.4 0>Here some text</style>
<style fillcolor=cmyk 0.1 0.3 0.4 0>Here some text</style>
Font size: <style fontsize="14">Here some text</style>
Group multiple settings: <style fontname="Times-Roman" fillcolor="0 0 0 1" fontsize="6">Here some text</style>
For example, in the contact info block of a business card, we want the words "Phone," "Cell," and "Fax" to be bold, but the numbers themselves to be Times-Roman and black and size 14.
The code we would add to this style is as follows. Note, the font block in the PDF is set to use Fontsize 8.
Phone:
Cell:
Fax:
The Style above would look like this in the Designer:
Validation allows you to control the formatting of the text entered by your customer when personalizing documents. The validation occurs after your customer types so that they will see the results of the validation.
Validation is implemented using Styles of type XML. The validation methods shown below will not function with Styles of type "Classic".
There are six different forms of validation that can be implemented using XML Styles:
Validation Type | XML Style | Action |
uppercase | Forces all text to be uppercase | |
lowercase | Forces all text to be lowercase | |
text | Only alphabetic characters and basic punctuation allowed | |
number | Only numbers allowed | |
phone | Forces certain formatting of phone numbers | |
Search and replace | Search for text and replace it with alternate text |
For all the validation methods listed above, you control whether the block will be a single line block or a multiline block by using the appropriate setting for type:
type="singleline"
OR
type="multiline"
With the "phone" validation method, the pound sign (#) is used as a placeholder for numbers in the phone number.
This can be accomplished for any input field by specifying the attribute
hidden="true"
<input name="field_name" type="singleline" hidden="true"/>
<input name="field_name" type="multiline" hidden="true"
In certain cases you may want to insert certain text into your document based on the text entered into certain inline fields. There are currently 3 conditions that can be test for and each has its own condition keyword:
In the examples below, there are 2 fields. In the 2nd field, we prompt the customer to enter their Office phone number. Based on the text entered by the customer, the 1st field will insert text.
In the example below using the "equals" condition keyword, if the text of Office phone number exactly equals text "123", the 1st field injects the text "This". If the Office phone number does not exactly equal text "123", the 1st field injects the text "That".
<input name="field_1" type="condition">
<if condition="equals" param="123" field="office">This</if>
<else>That</else>
</input>
<input name="office" type="singleline" default="123 456-789">
<process type="phone" pattern="### ###-####"/>
</input>
In the example below using the "regex" condition keyword, if the text of Office phone number matches the regular expression "^123", the 1st field injects the text "This". If the Office phone number does not matche the regular expression "^123", the 1st field injects the text "That".
<input name="field_1" type="condition">
<if condition="regex" param="^123" field="office">This</if>
<else>That</else>
</input>
<input name="office" type="singleline" default="123 456-789">
<process type="phone" pattern="### ###-####"/>
</input>
In the example below using the "empty" condition keyword, if the Office phone number is empty, the 1st field injects the text "This". If the Office phone number is not empty, the 1st field injects the text "That".
<input name="field_1" type="condition">
<if condition="empty" field="office">This</if>
<else>That</else>
</input>
<input name="office" type="singleline" default="123 456-789">
<process type="phone" pattern="### ###-####"/>
</input>