如何读取doc文件? [英] How to read .doc file?

查看:224
本文介绍了如何读取doc文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 .DOC 文件保存在我的 SD卡。我需要阅读 .DOC 文件的内容,并显示在一个的TextView

I have a .doc file saved on my sdcard. I need to read the content of .doc file and show it in a TextView.

谁能告诉我该怎么做呢?

Can anyone please tell me how to do this?

推荐答案

对不起我的错误。你需要这样做。

Sorry my mistake. You need to do this.

公共无效的onCreate(包B){
     super.onCreate(二);
      的setContentView(R.layout.main);
      。字符串extPath = Environment.getExternalStorageDirectory()getAbsolutePath()+文件分割符;
    为InputStream的InputStream = assetManager.open(extPath +FILE.DOC);
    字符串文本=的loadFile(InputStream的);
    TextView的电视=(的TextView)findViewById(R.id.txtv);
    tv.setText(文本);

public void onCreate(Bundle b){ super.onCreate(b); setContentView(R.layout.main); String extPath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.Separator; InputStream inputStream = assetManager.open(extPath + "file.doc"); String text = loadFile(inputStream); TextView tv = (TextView)findViewById(R.id.txtv); tv.setText(text);

}

这篇关于如何读取doc文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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