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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With