DOC,PPT,XLS MIME类型 [英] Doc, ppt, xls mime type

查看:574
本文介绍了DOC,PPT,XLS MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试打开 DOC,PPT,XLS PFG 与应用程序通过故意安装的文件。对于 PDF 我用 i.setDataAndType(Uri.fromFile(文件),应用程序/ PDF格式); 但如果我这样做如下:

I try to open doc, ppt, xls and pfg files with app installed via intent. For pdf I use i.setDataAndType(Uri.fromFile(file), "application/pdf"); but if I do following:

i.setDataAndType(Uri.fromFile(file), "application/doc");

我收到的例外,说没有任何的应用程序,可以处理的意图。我究竟做错了什么? 我已经安装了Quickoffice的,所以我认为它可以打开文件。

I receive exception, saying that there are no apps, that can handle intent. What am I doing wrong? I've got QuickOffice installed, so I think it could open file.

推荐答案

下面是一个链接为Microsoft Office文件的官方MIME类型。你可能有更好的运气,如果你在的地方应用程序/文件中使用应用程序/ MSWORD。

Here's a link to the 'official' mime types for Microsoft Office files. You'll probably have better luck if you use "application/msword" in place of "application/doc".

您也可以拥有操作系统尝试确定适当的MIME类型的文件:

You can also have the OS try to determine the appropriate mime type for a file:

String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(url));

希望这注册MIME类型,它可以处理会导致MIME类型的地图进行更新的应用程序。

Hopefully any application that registers a mime type that it can handle will cause the mime type map to be updated.

这篇关于DOC,PPT,XLS MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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