Creating a Custom Word Document using the ProntoForms DREL document

 

About

 

This article discusses one way to use the DREL document to create a customized Word document containing your form data. You can make it look exactly like your paper forms at need while maintaining the ease of data collection with our app.

DREL is a ProntoForms-specific language that is used to reference data in submitted forms (data records).  It can be used to build a string using properties from form submissions, including answers.  Read here for full details of the properties that DREL can reference.

A number of other document types are available, and multiple documents can be sent with a single form submission.  Read more about documents here.

 [ top ]

 

Create Your Document in Word

 

  1. In Microsoft Word, create a Word document that matches the desired output and design for your document. 



  2. Using DREL, map the data from your forms. 



     
  3. In Word, go to File -> Export -> Change File Type -> Save As. Choose "Word 2003 XML Document" as the file type. If you have questions that contain images (i.e., use the device's camera), please look at: Using Images in your Custom Word Document



  4. Look at your new XML document in Word, and correct any formatting issues that happened during the conversion.  Save it again if you make any changes.
  5. Find the XML file in the folder you saved it in.  Right click on it, then choose Open with -> Notepad (or any other plain text editor).
  6. In the plain text editor, right click, choose Select all and copy all the text.
  7. Create the document in the web portal and navigate to the Configuration tab.
  8. Paste the copied text in the ProntoForms DREL document "template" box. 
    1. Enter "doc" (without "." in front of it) in the File Extension field.
    2. Enter "application/msword" in the Content Type field.



  9. Select Create at the bottom of the screen.
  10. Preview using the form whose question labels you mapped into the template.  It should open in word, with sample data mapped into it.

 

[ top ]

 

Using Non Static Images in your Document

Non static images are images that may change depending on the form submission. This means that any question that:

  • is mapped in the document, and
  • uses a Camera or Sketchpad control

will need to use the following steps to correctly display your images:

  1. Before you save the document as an XML file, (Step 3 above), use a placeholder image where your desired image should be.
  2. Save the file as an XML file. Do not open it in Word. If you wish to make further changes after saving the file as an XML file, use a plain text editor.
  3. Open the XML file in Notepad or any other plain text editor. You will see your image encoded in base64, which will look something like the following:
    xml:space="preserve>R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn
    /9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/
    95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8
    ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/
    ...
    0bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw==></w:binData>
    <v:shape id="Picture 1" o:spid="_x0000_i1026" type="_x0000_t75">
  4.  Replace the entire Base64 string with %a[example_label][bytes]. Save your work and return to step 6 above.

Note: This method limits you to one picture per question label. This means that if you have multiple attachments in a question (i.e. multiple pictures in response to a question), only the first will come through. 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments