1

我想在 iphone 中开发一个应用程序,用户可以在其中打开一个 xls 文件,可以对已经存在的数据进行一些编辑并最终保存它。

我该怎么做?

4

2 回答 2

4

是的,Hardik 如果要打开本地 xls 文件,这非常简单。

  1. 将本地 xls 文件添加到您的项目中

  2. 将 UIWebView 控件拖放到视图上。

  3. 连接文件所有者和 UIWebView 对象

  4. 添加这个:

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

现在只需构建并运行

于 2009-12-14T06:11:10.747 回答
2

您可以使用UIWebView查看 XLS 文件,但无法对其进行编辑。iPhone SDK 中没有任何内置功能可以为您执行此操作。您可以尝试联系这些人,看看他们是否愿意将他们的软件许可给您。

于 2009-11-03T09:31:19.720 回答