Displaying ppt, doc, and xls in UIWebView doesn't work but pdf does

前端 未结 5 2134
感动是毒
感动是毒 2020-12-08 17:19

It looks like a few people on stackoverflow get this to work but their code isn\'t posted. I\'m using

[web loadData:data MIMEType:MIMEType textEncodingName         


        
5条回答
  •  南笙
    南笙 (楼主)
    2020-12-08 17:50

    UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0.0, 0.0, 1000, 760)];
    [webView setScalesPageToFit:YES];
    webView.backgroundColor=[UIColor clearColor];
    NSString *ppt = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"ppt"];
    NSURL *pptURL = [NSURL fileURLWithPath:ppt];
    NSURLRequest *request = [NSURLRequest requestWithURL:pptURL];
    [webView loadRequest:request];
    [self.view addSubview:webView];
    [webView release];
    

提交回复
热议问题