2016-08-04 23 views

回答

1
NSString *path = [[NSBundle mainBundle] pathForResource:@"data.docx" ofType:nil]; 
NSURL *url = [NSURL fileURLWithPath:path]; 
NSData *data = [NSData dataWithContentsOfFile:path]; 
[self.webview loadData:data MIMEType:@"application/vnd.openxmlformats-officedocument.wordprocessingml.document" textEncodingName:@"UTF-8" baseURL:url]; 

enter image description here

+0

是这个代码运行良好@Lidalu – gurmandeep

+0

NSString * path = [[NSBundle mainBundle] pathForResource:@“V3.4-1.docx”ofType:nil]; 的路径是零!!!但文件真正 – Lidalu

+0

它的工作原理,文件数据缺少一些信息,谢谢。 – Lidalu