How to open xls file in iphone application?
I want to devlop an application in iphone where user can open a xls 开发者_StackOverflowfile ,Can do some editing on data already present and finally save it.
How can i do it any idea?
Yes, Hardik it is very simple if you want to open a local xls file.
Add a local xls file in to your project
Drag and drop an UIWebView control on the view.
Connect Files owner and UIWebView Object
Add this:
- (void)viewDidLoad {
[super viewDidLoad];
//Get the path where your local xls file is located
NSString *FilePath = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"xls"];
//Now To use a local resource file in a web view you need to use NSURL fileURLWithPath:
NSURL *url=[NSURL fileURLWithPath:FilePath];
//URL Requst Object
NSURLRequest *requestObj=[NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[m_webView loadRequest:requestObj];
}
Now just Build and Go
You can use UIWebView
to view an XLS file, but you won't be able to edit it. There's nothing built in to the iPhone SDK that will do this for you. You could try contacting these folks to see if they would license their software to you.
精彩评论