Call COM/ActiveX from Java
Call Java from C# or Visual Basic
Build a COM/ActiveX component for Java classes in 15 minutes
Build a Java API for any COM/ActiveX component in 15 minutes
 

Calling Microsoft Word from Java using EZ JCom

The EZ JCom Java API for Microsoft Word is a complete MS Word API, as it has been automatically generated from the MS Word Type Library.

Java programs can use this API to run MS Word, either visibly or invisibly in the background, for automatic document generation/modification tasks.

Sample Programs

Following are some brief MS Word sample programs (also included in the pre-packaged version.)
  • Hello Word. This sample starts up a copy of MS Word, makes it visible, inserts the text "Hello Word", and leaves Word running for the user.
  • Writing Text and Saving to a File. This sample starts up a copy of MS Word, makes it visible, inserts some sample text (including a sample of working with the Font) and saves it as the file C:\EZJWordSample1.doc.
  • Opening, modifying and saving a File. This sample starts up a copy of MS Word, makes it visible, reads the file C:\EZJWordSample1.doc, modifies it and saves it.
  • Iterate over the contents. This sample starts up a copy of MS Word, does not makes it visible, opens the file C:\EZJWordSample1.doc, retrieves and prints out the text from the file. Leaves Excel running for the user.

Download

The MS Word API has been pre-built and packaged with the sample programs. Those interested in calling MS Word from Java should download this pre-packaged version instead of using the EZ JCom tool directly to build an API.

Please note that the pre-packaged API is built using MS Word 2000 for maximum compatibility. Newer features (such as the new "Save as PDF" feature using ExportAsFixedFormat) will not be available using this. However, when you purchase the Pro or Enterprise versions and build against your version of MS Word, these new features will be available and will work as expected.