验证和读取一个Word文件中的Andr​​oid [英] Validating and reading a Word file in Android

查看:182
本文介绍了验证和读取一个Word文件中的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够访问一个字文件在用户的手机的SD卡,该文件将被用户选择。我希望能够处理文件,即读其内容,并修改它,因为用户的意愿,并保存当用户点击保存。

I want to be able to access a word file in the sdcard of the user's phone, and the file will be chosen by the user. I want to be able to process the file, i.e. read its contents and modify it as the user wishes, and save it when the user clicks "save."

是否有可能在Android的?如何让程序知道该文件是Word文件?

Is it possible in Android? How can I make the program understand that the file is a Word file?

请注意,我不想要查看的Word文件。用户将选择Word文件,我的应用程序应该能够做出一些改变,并保存它。

Note that I don't want to view the Word file. The user will select the Word file and my app should be able to make some changes to it and save it.

推荐答案

最简单的方法恕我直言,是港口的Apache POI 库到Android。这是可能的,有证明

Simplest way IMHO is to port Apache POI library to Android. It's possible and there proof of that

移植POI您可以嵌入Word中编辑功能到应用程序中。

Porting POI you can embed Word editing feature into your application.

的code片这样的:

Intent intent = new Intent(Intent.ACTION_EDIT); 
Uri uri = Uri.parse("file:///"+file.getAbsolutePath()); 
intent.setDataAndType(uri, "plain/text"); 
startActivity(intent);

简单的说就是Word文件,将通过一些其他的应用程序进行编辑 - 不是你的。据我知道这是不是正是你想要的。

Simply means that Word file will be edited by some other application - not yours. As far as I understand it's not exactly what you want.

这篇关于验证和读取一个Word文件中的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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