在Cocoa Touch中阅读.ppt(MS PowerPoint)文件 [英] Reading .ppt (MS PowerPoint) file in Cocoa Touch
问题描述
有什么想法如何读取Cocoa Touch中的.ppt文件?
Any idea how to read a .ppt file in Cocoa Touch ?
我试图在UIWebView中加载文件的内容,但是没有工作。
这是代码:
I tried to load the contents of the file in UIWebView but it didn't work. Here is the code :
[aWebView loadData:[NSData dataWithContentsOfFile:filePath]
MIMEType:@"application/vnd.ms-powerpoint"
textEncodingName:@"utf-8"
baseURL:[NSURL fileURLWithPath:filePath]];
[powerWeb loadData:[NSData dataWithContentsOfFile:filePath]
MIMEType:@"application/vnd.ms-powerpoint"
textEncodingName:@"utf-8"
baseURL:[NSURL fileURLWithPath:filePath]];
所有建议都非常感激。
感谢
推荐答案
UIWebView 用于以可以直接在浏览器中查看的格式显示Web内容。 它不知道如何显示PowerPoint文件 - 大多数应用程序不,因为它是一个专有的Microsoft格式。(我立即纠正 - 显然, UIWebView 确实知道如何显示PowerPoint文件和其他,如果它不工作,我建议尝试不同的MIME类型,例如 application / mspowerpoint
。)请记住,只需将文件加载到NSData中并不意味着任何其他人都可以传递该数据,从而知道如何解释字节。
UIWebView is for displaying web content, in a format you could view directly in a browser. It has no idea about how to display PowerPoint files — most applications don't, since it's a proprietary Microsoft format. (I stand corrected — apparently, UIWebView does know how to display PowerPoint files and others. If it's not working, I'd suggest trying a different MIME type, such as application/mspowerpoint
.) Just remember that simply loading a file into an NSData doesn't mean that anyone else you pass that data to will know how to interpret the bytes.
您可以检查Microsoft是否提供了任何用于解析PPT文件的工具,或查看开源工具 - 例如,Google搜索经常转换为HTML。请注意,您的浏览器通常不会直接加载PowerPoint版本的文件。
You might check whether Microsoft offers any tools for parsing PPT files, or look around for open-source tools — for example, Google searches often convert to HTML. Just be aware that your browser is usually not loading a PowerPoint version of the file directly.
这篇关于在Cocoa Touch中阅读.ppt(MS PowerPoint)文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!