15
Jan
Written by: Jonathan Maron. Stored in: Templates.

Following my post yesterday about document creation in Microsoft Word, I would like to present another method.

If you own a copy of TX Text Control .Net, you already have a very nifty template designer installed on your hard disk. It is called TX Template Designer and is part of the basic install package of the aforementioned software component.

To create a template in TX Text Designer, just follow these brief steps.

  1. Open the TX Template Designer. The original location is at: C:Program FilesThe Imaging Source Europe GmbHTX Text Control 14.0.NETSamplesTX Template Designer. An empty document will be opened automatically.
  2. Insert a MergeField into the document by choosing Insert from the Insert main menu. Additionally, some sample text could be added to the test document.
  3. Click on the inserted field to open the Mini Editor dialog. This dialog can be used to rapidly step through all fields to change the names or to open the properties dialog.

    Type in the name of the field: “name”:

  4. Select Properties… in the Mini Editor dialog or press F2 to open the appropriate properties dialog. This dialog can be used to change the format of the field. Additionally, some advanced options can be adjusted. Select the settings as shown in the screenshot below:

  5. Repeat step 2 and 3 to insert another field and name this field “company”. Additionally, you could change the text of both fields. The finished template should now look like this:

Consider the following PHP5 code, which can be used to populate the template created above. Assume that the template has been saved with the filename template.docx:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$mailMerge = new Zend_Service_LiveDocx_MailMerge();
 
$mailMerge->setUsername('myUsername')
          ->setPassword('myPassword');
 
$mailMerge->setLocalTemplate('template.docx');
 
$mailMerge->assign('name',    'Henry Anderson');
$mailMerge->assign('company', 'Flowers Direct 2000');
 
$mailMerge->createDocument();
 
$document = $mailMerge->retrieveDocument('pdf');
 
file_put_contents('document.pdf', $document);

For a discussion on the logic of this source code, please see this post.

Bookmark and Share

3 Responses to “Template creation in TX Template Designer”

  1. Simon Says:

    Is there a chance to get a trail version of TX Template Designer or to by a stand-alone version?

  2. Björn Meyer Says:

    Hello Simon

    Very good question! In fact, we are working on a LiveDocx Edition of the TX Template Designer. In the meanwhile, you can download the trial version of “TX Text Control .NET Server” which comes with the TX Template Designer (valid for 60 days):

    http://www.textcontrol.com/downloads/trials/form/0.htm

  3. Simon Says:

    Thanks a lot! Looking forward to see the LiveDocx Edition!

Leave a Reply