Difference between revisions of "AppSuite:DocumentAutomation"

(Automatically fill fields in ODF templates)
 
Line 13: Line 13:
 
The source template or regular document needs to include fields of type “Mail merge field”.
 
The source template or regular document needs to include fields of type “Mail merge field”.
  
Note: In Open Office the field type is called “Mail merge field”. Unfortunately you can’t specify the name of the field, as you can only select items from an existing database. So you need to add fields with the desired name to the database that comes with Open Office. Alternatively, use “MergeField” in Microsoft Word and specify the name, but don’t forget to save as ODF.
+
Note: In Open Office the field type is called “Mail merge field”. Unfortunately you can’t specify the name of the field, as you can only select items from an existing database. So you need to add fields with the desired name to the database that comes with Open Office. Alternatively, use 'MergeField' in Microsoft Word and specify the name, but don’t forget to save as ODF.
  
 
=== The conversion process ===
 
=== The conversion process ===
Line 22: Line 22:
  
 
The general syntax for all the different ways to perform a conversion is:
 
The general syntax for all the different ways to perform a conversion is:
 +
 
https://appsuiteserver/appsuite/#!&folder=FOLDERID&id=FILEID&app=io.ox/office/text&EXTRA
 
https://appsuiteserver/appsuite/#!&folder=FOLDERID&id=FILEID&app=io.ox/office/text&EXTRA
Replae FOLDERID and FILEID with the actual values of your document.
+
 
 +
Replace FOLDERID and FILEID with the actual values of your document.
 +
 
 
EXTRA is one of the things described below:
 
EXTRA is one of the things described below:
  
 
==== Field values via URL ====
 
==== Field values via URL ====
 +
 
This solution is convenient if you have just a few fields. Keep in mind that the maximum length of the url is limited, the limit might vary from browser to browser.
 
This solution is convenient if you have just a few fields. Keep in mind that the maximum length of the url is limited, the limit might vary from browser to browser.
  
Line 34: Line 38:
  
 
url EXTRA parameter: fields=FIELDNAME1;FIELDVALUE1;FIELDNAME2;FIELDVALUE2
 
url EXTRA parameter: fields=FIELDNAME1;FIELDVALUE1;FIELDNAME2;FIELDVALUE2
FIELDNAME<n> is the name of the field, FIELDVALUE<n> is the text that you want to place into the field. Add as many name/valuie pairs as you want, separated by semicolon.
+
 
 +
FIELDNAME<n> is the name of the field, FIELDVALUE<n> is the text that you want to place into the field. Add as many name/value pairs as you want, separated by semicolon.
  
 
===== JSON notation =====
 
===== JSON notation =====
  
fields={“FIELDNAME1”:“FIELDVALUE1”,“FIELDNAME2”:“FIELDVALUE2” }
+
url EXTRA parameter: fields={“FIELDNAME1”:“FIELDVALUE1”,“FIELDNAME2”:“FIELDVALUE2” }
url EXTRA parameter: FIELDNAME<n> is the name of the field, FIELDVALUE<n> is the text that you want to place into the field. Add as many name/valuie pairs as you want, separated by comma.
+
 
 +
FIELDNAME<n> is the name of the field, FIELDVALUE<n> is the text that you want to place into the field. Add as many name/value pairs as you want, separated by comma.
  
 
==== Field values via CVS File ====
 
==== Field values via CVS File ====
Line 48: Line 54:
  
 
The csv file can use tabs, semicolons or commas as a separator. All fields containing commas or semicolons must be placed inside quotes. The first line in the csv file contains the field names, the second line contains the field values.
 
The csv file can use tabs, semicolons or commas as a separator. All fields containing commas or semicolons must be placed inside quotes. The first line in the csv file contains the field names, the second line contains the field values.
 +
 
url EXTRA parameter: fields-source=CSVFILEID
 
url EXTRA parameter: fields-source=CSVFILEID
 +
 
CSVFILEID is the id of the cvs file.
 
CSVFILEID is the id of the cvs file.

Revision as of 14:15, 5 May 2015

OX Text Field Automation

OX Text field automation

OX Text allows the user to automatically fill user fields in ODF text documents when creating a document from a template.

This can be achieve via regular urls passed to the browser, so that the process can also be triggered from outside, e.g. from a desktop application.

The data can easily be encodes in the url, but as the length of urls has limitations, you can also specify a cvs file in OX Drive.

The document template

The source template or regular document needs to include fields of type “Mail merge field”.

Note: In Open Office the field type is called “Mail merge field”. Unfortunately you can’t specify the name of the field, as you can only select items from an existing database. So you need to add fields with the desired name to the database that comes with Open Office. Alternatively, use 'MergeField' in Microsoft Word and specify the name, but don’t forget to save as ODF.

The conversion process

To create a new documents based on an existing document or template, with updating the content of the fields, you have different choices to pass the field data to OX Text.

The conversion URL

The general syntax for all the different ways to perform a conversion is:

https://appsuiteserver/appsuite/#!&folder=FOLDERID&id=FILEID&app=io.ox/office/text&EXTRA

Replace FOLDERID and FILEID with the actual values of your document.

EXTRA is one of the things described below:

Field values via URL

This solution is convenient if you have just a few fields. Keep in mind that the maximum length of the url is limited, the limit might vary from browser to browser.

To the base url described above, add the data in field/value notation, or in JSON notation.

field/value pair notation

url EXTRA parameter: fields=FIELDNAME1;FIELDVALUE1;FIELDNAME2;FIELDVALUE2

FIELDNAME<n> is the name of the field, FIELDVALUE<n> is the text that you want to place into the field. Add as many name/value pairs as you want, separated by semicolon.

JSON notation

url EXTRA parameter: fields={“FIELDNAME1”:“FIELDVALUE1”,“FIELDNAME2”:“FIELDVALUE2” }

FIELDNAME<n> is the name of the field, FIELDVALUE<n> is the text that you want to place into the field. Add as many name/value pairs as you want, separated by comma.

Field values via CVS File

The values can also be read from a cvs file located in OX Drive. This avoids exceeding the maximum url length.

CSV notation

The csv file can use tabs, semicolons or commas as a separator. All fields containing commas or semicolons must be placed inside quotes. The first line in the csv file contains the field names, the second line contains the field values.

url EXTRA parameter: fields-source=CSVFILEID

CSVFILEID is the id of the cvs file.