iOS解析Excel表格內容

https://github.com/molangwu/ExcelParseForIOSgit

解析Excelgithub

 

一、導入ExcelParser文件夾代理

二、設置Link Binary With Librariescode

三、新建PrefixHeader.pch文件blog

#import <Availability.h>

#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

四、設置Precompile Prefix Header 爲trueget

設置Prefix Header路徑it

五、運用代碼:設置代理 實現代理 須要傳入表格路徑 根據表格格式進行解析 有CSV XLS XLSX三種格式解析io

#import "ViewController.h"
#import "ExcelParser/LAWExcelTool.h"

@interface ViewController ()<LAWExcelParserDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

#pragma mark 開始解析
- (IBAction)didClicked:(id)sender {
    NSString *filePath = [[NSBundle mainBundle]pathForResource:@"test" ofType:@"xls"];
    [LAWExcelTool shareInstance].delegate = self;
    [[LAWExcelTool shareInstance] parserExcelWithPath:filePath];
    
}

- (void)parser:(LAWExcelTool *)parser success:(id)responseObj {
    NSLog(@"%@", responseObj);
}
相關文章
相關標籤/搜索