Word (Fill) - Preparing a Word document

Page / - last modified by nlo on 11.05.2021, 13:27

Preparing a Word document

last modified by nlo

on 11.05.2021, 13:27

Table of Contents

Word version

Inserting values from form fields

Example

Word Fill functionen

Available function

Problems creating checkboxes

Content [ Hide ]

Word version

Inserting values from form fields

Example

Word Fill functionen

Available function

Problems creating checkboxes

Actions of type Word (Fill) allow you to create a PDF document based on an existing word document.

Word form control element are replaced with the value of the corresponding form element. Use cases include summaries of contact forms or surveys.

Word version

All versions starting from Word 97 are supported.

Inserting values from form fields

Developer tools can be activated in the options under customize ribbon developer tools.

To insert values from the form into the the word document, you need to add form control elements to the word document.

Form controls are found under the developer tools tab. In case this tab is not available, activate it by going to files options customize ribbon developer tools.

Go to the developer tools tab to insert a text field form control. Give it a name and it will be replaced with the value of that form element.

Click on the developer tools tab and insert a text field. Double click on the text field, which opens a new window. Enter the name of the form element under default text. This text field is then replaced with the value of the form element with that name.

If the form element is a repeated element, the text field is replaced with the value of all dynamically created fields separated by a comma. For example, if there are three dynamic field, the value could be Anton,Sabine,Odo.

See also repeated fields.

Example

Example for how to insert data from a form into a word document. Form fields are selected based upon their name and the default text of the form control element.

In this example, the text field form control with the default text tfFirstName is replaced with the content of the form element named tfFirstName. Similarly, the text field form control tfLastName and tfQuestion are replaced with the corresponding form elements as well.

Word Fill functionen

Sometimes it is necessary to transform or edit the raw value of a form element before inserting it into the word document. This can be achieved with the following functions.

As an example, consider a form element of type selection. Its value is often numeric, eg. 0 (for no) or 1 (for yes). If you would like to insert the name of the option instead, use the function lsttxt(). That is, if the form element is named selQuestion, use selQuestion.lsttxt() as the default name for the form field control in the word document.

selQuestion.lsttxt()

Available function

Function	Description	Examples	Explanation
lsttxt	Replaces the value of the option of a selection element with its text (display) value. Stands for list text.	SEL1.lsttxt()	Returns the text value of the selected option of the selection element with the name SEL1.
lsttitle	Replace the value of the selected option of a selection element with its title. Stands for list title.	SEL1.lsttitle()	Returns the title (if given) of the selected option of the selection element with the name SEL1.
lst	Replaces all values of a selection with the corresponding col attribute. The col-attribute must be passed with the serial number. The first column has the number 0. If a data source is used that uses the first row as header, than the column needs to be addressed by its column header name instead of the col-Attribute.	SEL1.lst(col2) or SEL1.lst(title)	Returns the 3rd column or the column with the name "title" (if the first row is used as header) of a data source (if stored) of the selection element with name SEL1.
con	Checks whether the value exists in the list. Useful for selection elements with multiple choices. Stands for contains.	SEL1.con(5)	Returns 1 if an option with the value 1 was selected for the selection element named SEL1, or 0 otherwise.
cnt	Counts the number of values for dynamic elements. Stands for count.	SEL1.cnt()	Returns the number of dynamically generated elements for the dynamic selection element SEL1.
rmp	Deletes the current paragraph if the value is empty. Stands for remove paragraph.	TF1.rmp()	Deletes the current paragraph if the form element TF1 is empty.
rmr	Deletes the current table row. Stands for remove row.	TF1.rmr(x)	Deletes the current row of the table if the text field TF1 has a value equal to x.
rmt	Deletes the current table. Stands for remove table.	TF1.rmt(y)	Deletes the current table if the text field EL1 has a value equal to y.
rmtp	Deletes the current table and the following paragraph. Stands for remove table paragraph.	TF1.rmtp(y)	Deletes the current table and the following paragraphs if the text field TF1 has a value equal to y.
rep	Replaces the value with another value. The argument syntax is EL.rep(W1|W2#R1|R2) or EL.rep(W1#R1). Stands for replace.	EL1.rep(on|off#x|o)	The value on is replaced with xand the value off is replaced with o.
cf	Changes the character set to Wingdings. Mostly used in combination with the rep function. Stands for change font.	SEL1.rep(on|off#x|o).cf()	The value on is replaced with x, off with o. Afterwards the values x and o are replaced with their corresponding Wingdings symbols (cross and circle).
image	Interprets the value as an URL and replaces it with the image found at that URL. You can also set width and height for the image.	TF1.image(), TF1.image(100|100), TF1.image(100), TF1.image(|100)	Inserts an image found at the URL pointed to by the value of the text field TF1. Examples for height specifications: TF1.image(width|height), eg. TF1.image(579|410). If you only specify an width (TF1.image(579)) or height (TF1.image(|410)), the resulting image will be scaled to maintain the aspect ratio.
b64img	Converts a base64 string to an image. You can also transfer width and height information.	TF1.b64img(), TF1.b64img(100|100), TF1.b64img(100), TF1.b64img(|100)	Interpretes the field value as a base64 string and inserts it as an image into the document. The base64 string should look like iVBORw0KGgoAAAANSUhEUgAAABAAAA.... Examples for height specifications: TF1.b64img(width|height), eg. TF1.b64img(579|410). If you only specify an width (TF1.b64img(579)) or height (TF1.b64img(|410)), the resulting image will be scaled to maintain the aspect ratio.
url	Interprets the value as an URL and generates a link to that URL.	TF1.url()	Adds a link to the PDF document with the address taken from the value of the text field TF1.
cb	Generates a checked checkbox if the the value contains the given parameter. Generates an unchecked checkbox otherwise. Stands for Checkbox.	SEL1.cb(1)	Generates a checked checkbox, if there is a selected option with the value 1 for the selection element SEL1, or an unchecked checkbox otherwise.

Problems creating checkboxes

If no checkboxes are created in the generated PDF document when using the function cb(), it is probably due to missing fonts on the server. This problem usually occurs only when Xima® Formcycle is installed on a Linux server.

To solve the problem, try:

Log in to the Linux server with Xima® Formcycle

Go to the system fonts folder (eg. /usr/share/fonts/truetype/ for Debian/Ubuntu) and check whether the fonts windings.ttf and windings2.ttf are installed.

If not, copy these fonts to the folder. Due to licensing issues we cannot ship the product with these fonts, so you must copy them yourself from a Windows installation.

Restart the Tomcat server.