分類  >  Web前端 >

iphone之打開pdf、doc、xls資料用UIWebView

tags:    時間:2013-12-10 07:58:32
iphone之打開pdf、doc、xls文件用UIWebView
//文件名字及類型     NSString *path=[[NSBundle mainBundle]pathForResource:@"xls1" ofType:@"xls"];     //獲取內容     NSData *data = [[NSData alloc]initWithContentsOfFile:path];     NSString *string = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];     NSLog(@"%@",string);          UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 55, 320, 300)];     webView.delegate = self;     webView.multipleTouchEnabled = YES;     webView.scalesPageToFit = YES;          NSURL *url = [NSURL fileURLWithPath:path];     NSURLRequest *request = [NSURLRequest requestWithURL:url];     [webView loadRequest:request];          [self.view addSubview:webView];

推薦閱讀文章

Bookmark the permalink ,來源:互聯網