我正在尝试从Microsoft Word文档(.doc, .docx, .docs)中读取文本。我已经搜索了一整天,但没有找到任何解决方案。请问有人能告诉我该怎么做吗?我已经尝试使用UIWebview从javascript中获取文本,但这种方法也不起作用。
- (NSString *)textFromWordDocument:(NSString *)path {
UIWebView *theWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[theWebView loadRequest:request ];
NSString *document = [theWebView stringByEvaluatingJavaScriptFromString:@"document.documentElement.innerText"];
[theWebView release];
return document;
}
如果有人能告诉我应该做什么或者在哪里寻找,那对我来说将非常有帮助。谢谢。