Navigation



Word XML Mail Merge Sample

A sample standalone SWT application that embeds Word documents. It provides an XML mail merge feature to merge an XML file with a word document. This sample demonstrates how to merge the menus of an OLE Document with the menus of a SWT shell. It also demonstrates how to use SWT OleClientSite class to execute site based commands on an embedded OLE document.

SWTtoCOM Word XML Mail Merge Sample

Building and Running the sample

Before building the samples you need to have the following software;

  1. Eclipse 3.2 or later. Download from http://www.eclipse.org/downloads/
  2. SWT 3.2 or later. Download from http://www.eclipse.org/swt/

SWTtoCOM only needs SWT at runtime, however these samples also make use of other Eclipse based libraries such as JFace.

Instructions for building and running the samples are available with the following methods;

Using the sample

  1. Once the sample is running and the Main Window of the sample is displayed. Select File > Open Document menu option.
  2. The SWT standard open dialog appears. Navigate to the example.doc word document provided with the sample and open it by clicking the Open button.

    Open Dialog


  3. The document appears embedded in to SWT Java application. Note that the menus of Word have been merged with the File menu in the SWT shell. A toolbar appears that has been contributed by Word.
  4. Select File > XML Mail Merge menu option.
  5. Navigate to the example.xml file provided with the sample and open it by clicking the Open button.

    Open Dialog


  6. Finally you should see the XML Mail merge automation running as it merges the contents of the XML file with the Word document.