• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java + COM (Ms Word)

 
Raf Szczypiorski
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • 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Ƃ
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apache POI is the API people usually use to do this.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic