Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIWebView, Word office document and pagination

When UIWebView loads Microsoft word documents, it just loads it as if it's one whole strip of paper, disregarding the separation between pages. Any idea how to display it properly (pages separated from each other), I'm open to lower level programming, or alternatives to UIWebView for loading Office documents. I'm currently using IPhone OS 3.2 for IPad.

E.g. I tried creating a word document with 2 pages, and one paragraph on each page, when I load it in UIWebView, it's displayed in one page.

The code I used is from Apple Technical Q&A

-(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];
}

// Calling -loadDocument:inView:
[self loadDocument:@"test1.doc" inView:self.myWebview];

As a side note, I'm thinking this should be possible because there are apps like Documents to Go and QuickOffice, I'm not sure how they implemented it.

like image 985
Manny Avatar asked Jul 12 '10 07:07

Manny


1 Answers

At the current SDK, it's not possible. We ended up implementing our own and used UIScrollView to meet our requirements. This was a lot of work implementing our own renderer, own panning system, etc.

like image 74
Manny Avatar answered Oct 03 '22 22:10

Manny