iOS 读取Excel 等文件
2014-09-04 12:07
961 查看
方法一:使用QuickLook.freamwork
UIDocumentInteractionController *document = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:@"/Users/a502333921/Desktop/ブック2.xlsx"]];
document.delegate = self;
NSLog(@"%d",[document presentPreviewAnimated:YES]);
- (UIViewController*)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController*)controller
{
return
self;
}
- (UIView*)documentInteractionControllerViewForPreview:(UIDocumentInteractionController*)controller
{
return
self.view;
}
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController*)controller
{
returnself.view.frame;
}
//点击预览窗口的“Done”(完成)按钮时调用
- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController*)_controller
{
}
此方法弹框显示文件 也可以通过其他软件打开文档
方法2:
QLPreviewController *previewoCntroller = [[QLPreviewController alloc] init];
previewoCntroller.dataSource = self;
[self presentViewController:previewoCntroller animated:YES completion:nil];
- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller
{
return1;
}
- (id <QLPreviewItem>)previewController: (QLPreviewController *)controller previewItemAtIndex:(NSInteger)index
{
return [NSURLfileURLWithPath:@"/Users/a502333921/Desktop/ブック2.xlsx"];
}
方法三
UIWebView
方法四:
通过DHxls框架 https://github.com/dhoerl/DHlibxls
问题:
当你加载Excel时候,可能会出现部分气泡中内容不显示等情况,请重新保存为xls格式文档!
UIDocumentInteractionController *document = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:@"/Users/a502333921/Desktop/ブック2.xlsx"]];
document.delegate = self;
NSLog(@"%d",[document presentPreviewAnimated:YES]);
- (UIViewController*)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController*)controller
{
return
self;
}
- (UIView*)documentInteractionControllerViewForPreview:(UIDocumentInteractionController*)controller
{
return
self.view;
}
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController*)controller
{
returnself.view.frame;
}
//点击预览窗口的“Done”(完成)按钮时调用
- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController*)_controller
{
}
此方法弹框显示文件 也可以通过其他软件打开文档
方法2:
QLPreviewController *previewoCntroller = [[QLPreviewController alloc] init];
previewoCntroller.dataSource = self;
[self presentViewController:previewoCntroller animated:YES completion:nil];
- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller
{
return1;
}
- (id <QLPreviewItem>)previewController: (QLPreviewController *)controller previewItemAtIndex:(NSInteger)index
{
return [NSURLfileURLWithPath:@"/Users/a502333921/Desktop/ブック2.xlsx"];
}
方法三
UIWebView
方法四:
通过DHxls框架 https://github.com/dhoerl/DHlibxls
问题:
当你加载Excel时候,可能会出现部分气泡中内容不显示等情况,请重新保存为xls格式文档!
相关文章推荐
- ios 使用NSURlSession 下载文件并且使用进度条进行文件下载进度读取以及打开附件(word,excel,ppt,pdf)显示
- 用C#读取Excel文件:从指定单元格开始向右向下读取数据
- poi读excel文件的时候报错POI读取Web主机Excel文件
- .NET读取EXCEL文件的问题
- ASP.NET中上传并读取Excel文件数据
- ADO 读取Excel文件数据, 丢失数据或数据错误问题。
- 读取Excel文件
- ASP.NET中上传并读取Excel文件数据
- 今天解决了两个关于.NET读取EXCEL文件的问题,记下来,很有用!
- 读取Excel文件中的数据
- 读取Excel文件
- aspnet读取excel的文件到datagrid中
- C#中Excel文件的读取
- 生成/读取(反向更新数据库) Excel文件(示例代码下载)
- 今天解决了两个关于.NET读取EXCEL文件的问题,记下来,很有用!
- OleDB读取Excel文件时的一个故障
- 使用Java读取Excel文件内容
- 使用Java读取Excel文件内容
- ASP.NET中上传并读取Excel文件数据
- ASP.NET中上传并读取Excel文件数据