iphone - Can’t Display A Microsoft Word.doc document on UIView Controller -


i’m using code below display pdfs or filename.doc microsoft word documents. works fine when use oftype:@:”pdf”, code crashes when use oftype:@:”doc” or oftype:@:”docx”. word document text , few url links. appreciated.

nsstring *path = [[nsbundle mainbundle] pathforresource:@"c9" oftype:@"doc"]; pdfurl = [nsurl fileurlwithpath:path];} [webview loadrequest:[nsurlrequest requestwithurl:pdfurl]]; 

as per code, looks you're using uiwebview.

here code i've used in past.

-(void)loaddocument:(nsstring*)documentname inview:(uiwebview*)webview {     nsstring *path = [[nsbundle mainbundle] pathforresource:documentname oftype:nil];     nsurl *url = [nsurl fileurlwithpath:path];     nsurlrequest *request = [nsurlrequest requestwithurl:url];     [webview loadrequest:request]; } 

in viewdidload (change webview frame whatever need)..

uiwebview *webview = [[uiwebview alloc] initwithframe:cgrectmake(10, 10, 200, 200)]; [self.view addsubview:webview];  [self loaddocument:@"file.doc" inview:webview]; 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -