• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java + COM (Ms Word)

 
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. Does anybody have any experience with using COM objects with Java? I specifically need to open word, open a document and do some stuff with it. What libraries have you used? Any tutorials?

Regards,
RafaƂ
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apache POI is the API people usually use to do this.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're all set to use COM instead of a pure Java solution, here are a few libraries that can help with that: http://faq.javaranch.com/java/JavaIntermediateFaq#callingCom
 
Raf Szczypiorski
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
thanks for your answers.
@Paul: as far as I know, POI allows me to manipulate the documents from Java code. This is not what I need to do. I will give the main use case - the user creates a Word template file (dot) with fields from a data source. Then, using our application, they will search for some data, export it do a data source that Word supports (like RTF file for instance), and will open Word with the template and the data source merged. That's it, we don't have to do anything else.
Please, if I am wrong don't hesitate to tell me, if there is a simpler approach I will most certainly consider it. Please note that opening Word is a requirement. If Word supported command line switches that take a tempalte and a data source as input, I could simply fire it up with the usual Java Process API, but I did some research and it looks like that using Word as a COM object is the only way to go. Also, I had some bad experiences with POI and Docs some time ago (it was fine for Xls though).

@Ulf: thanks for the link. Currently I am playing a bit with JACOB, and it looks fine. I didn't know about Jawin and the IBM solution, will take a look at that, thanks.

Regards,
Raf
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic