MS Word Templates for Recruitment

The purpose of this page is to describe the technical solution related to handling of MS Word document templates with respect to Recruitment component.

The solution is based on the mail merge function in Microsoft Word. The Word document contains a number of merge fields and it is connected to a source file that contains the data (in table format).

The name of the merge fields must correspond the column names in the source file.

When the Mail Merge function is performed, the Word document reads the data from the source file and merge the data into the document. There will be a new page for each row in the source table.

For more information about the mail merge function, see the help documentation in Microsoft Word.

Contents

Technical Description

This section describes all necessary steps how to transfer data from the application to Word documents.

Selecting Data in the Application

All records and attributes that should be transferred to the word document are fetched from the database in the IFS Enterprise Explorer client.

Normally the user populates an overview windows, marks some rows and performs a RMB Generate … Document.

If all attributes exists in the overview window there is no need for additional database calls. However if additional attributes (not present in the form) should be transferred, these attributes must be fetched separately before the temporary source file is created

Creating Temporary Source File

The IFS Enterprise Explorer client loops through the selected rows and writes the data to a temporary file. The temporary file will be created in the user's temp directory, normally c:\temp. These files will not automatically be removed, but since the same file name will be used, the number of temporary files (per user) will be limited (never exceed the number of word documents) .

Several different file formats can be used as source for the mail merge procedure in Word. This solution use html format due to the fact that it is a pure text file and that is not very likely that records and field delimiters (<tr> and <td>) will conflict with data in the application.

As an example we can look at the source file for a document displaying name and address for a number of applicants. The source file should for this case have the following contents,

<html>
 <body>
  <table border=1>
   <tr>
    <td>name</td>
    <td>address</td>
   </tr>
   <tr>
    <td>Alain Prost</td>
    <td>East Road 17<br>Monaco</td>
   </tr>
   <tr>
    <td>Juan Pablo Montoya</td>
    <td>West Road 18<br>Colombia</td>
   </tr>
   ...
  </table>
 </body>
</html

Note: Line breaks in the data must be replaced with a html line break tag (<br>)

Word Document

The word document should reside in the runtime directory.  Example?

It has a number of named Merge fields. The Merge field names must correspond with the column names in temporary source file.

If we use the previous example, the document should have the Merge fields: name and address.

The document also has a Visual Basic macro,

   Public Sub DoMailMerge( sFile As String)

The word document is opened from IFS Enterprise Explorer and the macro is invoked with the temporary source file (including path) as argument.
Since no modifications will be made to this word document, it will not conflict with a write protected runtime directory.

Mail Merge

The word documents starts to execute the macro. The macro define the temporary file as source for the mail merge and then starts the actual merge.

When Word has completed the mail merge, the result will be sent to a new Word document. There will be a new page for each record.

Closing the Original Word Document

When the new document has been created, the centura client closes the original document. This means that the user will only see the new document.

Configuring generate document functionality in IFS EE

The Application supports only English language regarding generate document functionality. In order to use this functionality, a customer who is from a different language context needs to configure his environment. The step by step process of configuring the environment is shown below. In following example it was described how we can achieve it in Swedish language.

1. Copy all Swedish (…sv.doc) template files to rcruit\client\runtime\ folder.
2. Edit rcruit\source\rcruit\client\ComponentDeploy.target file by adding relevant entries.
eg: ………………………………………
……………………………………...
<Files Include="$(FndDeployTarget)\Acknowledgement of application letter receivesv.doc"/>
<Files Include="$(FndDeployTarget)\Declining Applicantsv.doc"/>
………………………………………
………………………………………
3. Run a build.
 

Note:
1. The files added to the runtime folder will be copied to a suitable build folder by build process.
2. The purpose of adding template file entries to ComponentDeploy.target file is to download all the template files from the server to the client machine when navigating any form which supports generate document functionality in RCRUIT component.