2016-08-04 22 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