0

I can download documents which can be of types .pdf,.xlsx,.jpeg,.tiff etc from an API. If I use UIWebView it doesnot support .xlsx and .msg files.

How can I view these files.

Can anyone help me ?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Aswathy Bose
  • 4,279
  • 4
  • 32
  • 44

2 Answers2

2

You can use the QLPreviewController to display all of these types of files.

A Quick Look preview controller can display previews for the following items:

  • iWork documents
  • Microsoft Office documents (Office ‘97 and newer)
  • Rich Text Format (RTF) documents
  • PDF files
  • Images
  • Text files whose uniform type identifier (UTI) conforms to the public.text type (see Uniform Type Identifiers Reference)
  • Comma-separated value (csv) files
rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • I have an option to take screenshot.So if I am using QLPreviewController, I only can view files , on taking screenshot ,that screen will be fully blank since ios 6 the QLPreviewController is actually a completely seperate app (seperate process and everything)so when you push that, your whole app moves to the bg, including its window and gesture recognizers So I can't use QLPreviewController – Aswathy Bose Jun 27 '13 at 05:43
  • `QLPreviewController` is just a `UIViewController` that you present like any other view controller in your app. – rmaddy Jun 27 '13 at 05:47
  • When I take the screenshot after subviewing the qlpreviewviewcontroller, that is blank. Can you please check this link http://stackoverflow.com/questions/12675378/ios-6-uigestures-tap-stops-working-with-qlpreviewcontroller and let me know whether my assumption is right or wrong? – Aswathy Bose Jun 27 '13 at 05:51
  • Honestly, I don't know if that is correct or not. I use `QLPreviewController` in my app and it does what I need. For me, the implementation details don't matter. – rmaddy Jun 27 '13 at 05:55
  • @AswathyBose Aswathy, I have the same EXACT issue you have. I need to take a screenshot upon opening it, so I have to use UIWebView. But it doesn't support XSLX. Did you ever find a solution to this? Thanks. – datWooWoo Jan 06 '17 at 17:29
  • QLPreviewController, incredibly, has no callbacks to tell you when the document has loaded. So this is not a solution. Any others please? – datWooWoo Jan 06 '17 at 17:41
0

use this code u will get satisfied

-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webView
{
NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:file type];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}

try this it will help you to make zimmicks with any type of file

ashokdy
  • 1,001
  • 12
  • 21