开发者

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.

  1. Add a local xls file in to your project

  2. Drag and drop an UIWebView control on the view.

  3. Connect Files owner and UIWebView Object

  4. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜