在我的Android应用程序中查看excel文件 [英] Viewing excel files in my android app

查看:536
本文介绍了在我的Android应用程序中查看excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Android应用程序,其中我必须打开&关闭excel文件按钮点击。这些excel文件将是只读的。关闭excel文件后,应该引导我到应用程序。



请建议我这样做。

解决方案

是一条手动路线。



如何使用JXL 2.6.12 jar来阅读excel文件



但这里更容易一些。 / p>

打开应用程序



但我想你必须找出 MIME TYPE



编辑



获得了MIME类型



为excel设置MIME类型文件



更新



所以这样的事情可能会起作用。

  Intent intent = new Intent(Intent.ACTION_VIE W); 
intent.setDataAndType(path,application / vnd.ms-excel);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);


try {
startActivity(intent);
}
catch(ActivityNotFoundException e){
Toast.makeText(OpenPdf.this,No Application Available to View Excel,Toast.LENGTH_SHORT).show();
}


I'm working on an Android app in which I have to open & close excel files on button click. These excel files will be readonly. After closing the excel file, it should direct me to the app.

Please suggest me a way to do this.

解决方案

here is a manual route.

How to read excel file using JXL 2.6.12 jar

but here is a little more easier one.

open application

but i guess you have to find out the MIME TYPE.

EDIT

got the mime type as well

Setting mime type for excel document

UPDATE

so something like this might work.

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/vnd.ms-excel");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);


try {
    startActivity(intent);
} 
catch (ActivityNotFoundException e) {
    Toast.makeText(OpenPdf.this, "No Application Available to View Excel", Toast.LENGTH_SHORT).show();
}

这篇关于在我的Android应用程序中查看excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆