1

I have a Java application and would like to know if anyone knows about the existance of a Microsoft Office component that would allow my end users to do some basic manipulation of Word and Excel documents without having MS Office installed.

I guess Open Office suit my need, but I'm not sure. Is there anything besides Open Office?

Thanks a lot

2 Answers2

2

The Apache POI Project should do what you need:

The Apache POI Project's mission is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft's OLE 2 Compound Document format (OLE2). In short, you can read and write MS Excel files using Java. In addition, you can read and write MS Word and MS PowerPoint files using Java. Apache POI is your Java Excel solution (for Excel 97-2008). We have a complete API for porting other OOXML and OLE2 formats and welcome others to participate.

Unless you want an office suite which replaces Microsoft's Office.

EDIT: As per your comment,

I think that it might be a good idea to have your application attempt to open a document, excel sheet, etc. through the user's default application. This can be either Office, Open Office, Lotus Notes, etc. Should the user not have anything with which they can open such files, then, the application should display a message which tells the user that there are no applications installed which can handle such files, and maybe provide a recommendation to Open Office since it is free and quite capable.

Office suites are, in my opinion, quite complex structures which needs to provide a wide series of functionalities. If you just want to open the document then I think that you could do a JFrame which loads up the document, but since you also need to make alterations to the document then I think it would be best if you used something which is already available.

Also, a minor thing, but can have a huge impact on your application, doing everything your self could have negative impacts on your users from a User Experience stand point on its own. Having them install their application of choice will allow them to, hopefully, work with something with which they are familiar and comfortable with.

npinti
  • 51,780
  • 5
  • 72
  • 96
  • But Apache POI from what I see it's a component to programatically generate/modify office files. My requirement is to display excel and word files on my forms and let the user do some manipulation (e.g adding text, formatting, etc). Thanks – Christopher Bailey Apr 09 '15 at 10:45
  • @ChristopherBailey: I have updated my answer, you will hopefully find this helpful. – npinti Apr 09 '15 at 10:55
  • Thanks @npinti I understand your point but my specific requirement is to have that. So I assume no components are available for that right? – Christopher Bailey Apr 09 '15 at 10:58
  • @ChristopherBailey: I am not aware of any that do. You might find some which might or might not be freely available. That being said, I strongly recommend against implementing this on your own. – npinti Apr 09 '15 at 10:59
  • I have the same opinion, but since we need to implement a custom behaviour there's no other option. Thanks (Will accept your answer still). – Christopher Bailey Apr 09 '15 at 11:01
  • @ChristopherBailey: I understand. As a last resort, you can take a look [here](http://stackoverflow.com/questions/196980/can-anyone-recommend-a-java-rich-text-editor) for some pointers on the matter. – npinti Apr 09 '15 at 11:38
0

I think you may want to consider separate solutions for each of Word and Excel.

That said, these do exist. In terms of technology, you can choose between:

  • pure Java solutions (using eg Swing)
  • in-browser (either involving HTML round trip, or better, not)
  • platform specific native code (invoked from Java)
JasonPlutext
  • 15,352
  • 4
  • 44
  • 84