Export to Word
Introduction
Word export functionality in smart forms allows the admin to create output reports in word format by mapping fields in the smartform. Export can be done at any stage of the form workflow. In order to use this functionality, the admin must have xml editor installed. The steps are as follows:
- Add placeholders in Word file.
- Save the word file as an .xml file and edit using XML editor
- Add mappings in form template
- Example form and xml file
Add Placeholders in Word File
Placeholders are where the values have to be populated on the Word output. These placeholders are later replaced with field numbers in xml editor.
- Open the Word file that you want to use in order to get the output.
- Put placeholders (symbols - ^ or @) at the locations where you want the values to be populated. An example is shown below:
Please make sure that you always use symbols and not numbers. Numbers will break the xml editor in the next stage.
Save Word File as XML and Edit Placeholders
- Save the file (or a copy of it) as an xml file.
- In order to edit this file, xml editor will be needed. If you do not have xml installed, please find the editor here: http://www.firstobject.com/foxe242.zip
- If it’s the first time you are using firstobject, goto “Tools -> Preferences”, make changes as below. Then click “OK” and press “F8”. This will make the file more readable.
-
In XML Editor, go to the place that you want to mark for the smart form field (using control F) and replace the symbol with ${Rnumber}.
Eg: For the first field, replace symbol with ${R1}. Remember these numbers will be using for mapping in the next stage.
You can see the label of the field as well (few lines above the symbol). See example below:
- Save the xml file.
- Also, once the xml file is edited and saved, do not open it up in word again. This will break the formatting. Always open it in xml editor.
Add Mappings in the Form Template
-
Open the relevant form in form library, edit and go to workflow wizard.
-
Go to “Enable customised word format” – Yes or No. Mark it as Yes.
- Browse the XML file and save. It should appear as below:
- Once file is uploaded, we need to add mapping records. Click on “Add Record”. The following window opens up:
- Add the mark number for the field (in this case, it is 1), right click on the smartform field and select the field:
- Add a suitable description for future reference:
-
On how condition is used when one field has multiple values.
Eg: Field – Phase of flight has dropdown values of take-off, climb, cruise, descent etc. Hence the field remains the same and we use on how condition as shown below. On the word export file, there will be a tick mark next to the selected value.
- The output would look like this, based on user’s selection:
Another example:
-
Once the mappings are done, drag “Export to word” button onto the template (if not present already).
-
Save the template.