29

Does anyone know of a good Java Microsoft Office API capable or running on an Android? I know there is an OpenOffice Java API, but I haven't heard of anyone using it on Android.

I know that using intents is another option, but how common are pre-installed office viewers on the varying Android distributions? Would it be reasonable for a developer to expect the user to have one of these viewers installed? Is it reasonable to request that they install one of these applications if they don't already have one?

Jason Plank
  • 2,336
  • 5
  • 31
  • 40
matheeeny
  • 1,714
  • 2
  • 17
  • 32
  • Some devices come with a doc viewer. Galaxy Tab does, I am not sure how many of the total devices out there do though. – FoamyGuy Jan 31 '11 at 19:56

5 Answers5

15

Since most of the documents we need to display are already hosted on the web, we opted to use an embedded web view that opens the document using google docs viewer.

We still have a few locally stored documents though that this approach doesn't work with. For these, our solution was to rely on the support of existing apps. After spending some more time with Android, It seems that most devices come equipped with some sort of document/pdf reading capability installed fresh out of the box. In the event that they don't have a capable app, we direct them to a market search for a free reader.

matheeeny
  • 1,714
  • 2
  • 17
  • 32
  • 3
    Now it not available. 400. That’s an error. The requested URL was not found on this server. That’s all we know. – A Maharaja Jan 02 '18 at 14:54
  • This is not an option is the user has no internet connection or in case of handling high sensitive data documents. PDFTron comes here. – Duna Jun 29 '22 at 12:18
9

Unfortunately there's no built in Android control to edit MS Office files, or even to display them! It's a pretty big omission given iOS has built in support for displaying Office files (albeit the iOS one often displays more complex documents incorrectly). There don't seem to be viewer app consistently enough available to rely on (and they may not provide the kind of user experience you're hoping for either).

If you want to display or edit docx etc within your android application, you have to embed some third party code that adds this functionality. I'm not aware of any pre-packaged open source code that can do this, so unless you want to build/port a solution yourself you will need to commercially license something.

As others have noted, there are some open source projects in this area, but they're not packaged/ported to Android. If you did manage to get them ported and integrated, they'd add a huge overhead to your Android app download (eg. 80+ megabytes) and you'd need to then add a mobile suitable UI for them (see https://play.google.com/store/apps/details?id=com.andropenoffice&hl=en_GB for an example of a port with ui that I personally think is not suitable/user friendly for an Android application.)

One such SDK that I'm familiar with which solves this problem is based on the SmartOffice application:

https://artifex.com/products-smart-office-overview/

It's available as an secure embeddable library that supports both display and (optionally) editing of Office documents. You can contact sosales@artifex.com for licensing information.

Disclosure: One of my jobs involves working on the SmartOffice code.

JosephH
  • 37,173
  • 19
  • 130
  • 154
  • joseph, please suggest me any demo link. – Om Infowave Developers Nov 24 '17 at 06:24
  • @OmInfowaveDevelopers http://smartoffice.artifex.com/ has links to Google Play & iOS App Store apps that show you what SmartOffice can do, or email sosales@artifex.com to get an evaluation SDK. – JosephH Nov 24 '17 at 06:43
  • In smartOffice official site there is no documentation and sdk provided to integrate it in app. And I have got no response from their contact support. @JosephH – Nainal May 04 '18 at 07:38
  • @Nainal I don't know why that would be - if you drop me an email at my home address ( joseph@heenan.me.uk ) I'll make sure someone gets in touch. – JosephH May 04 '18 at 13:43
7

Most of the Microsoft Document viewers are heavy and expensive.

If you want to create a viewer yourself, you should take a look at Apache POI.

Jason Plank
  • 2,336
  • 5
  • 31
  • 40
TomTasche
  • 5,448
  • 7
  • 41
  • 67
1

A suitable solution might be using Jword in the link below. It's not free but easy to use. http://www.independentsoft.de/jword/index.html

Using the library is as simple as this sample code

private String docxRead(String filePath) {
    try {
        WordDocument doc = new WordDocument(filePath);
        String text = doc.toText();
        return text;
    }
    catch (Exception e) {
        Toast.makeText(context, e.getMessage(), Toast.LENGTH_SHORT).show();
        e.printStackTrace();
    }
    return "";
}    
masoud
  • 116
  • 1
  • 1
  • 10
  • Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Bhargav Rao Mar 28 '16 at 13:56
0
You can use this example for read MS word document file in android application.
I give a link below, you follow this for example.
 <https://github.com/AsposeShowcase/Document_Viewer_and_Converter_for_Android>

And follow below link for Aspose Word library for android.
 <http://www.aspose.com/android/word-component.aspx>

**You Mostly use for this to Read Ms word document.**
I hope, you will using these Library and make you application better.
Best of Luck.


[1]: http://www.aspose.com/android/word-component.aspx
Gundu Bandgar
  • 2,593
  • 1
  • 17
  • 21