iOS -DHlibxls读取Excel数据:下载链接及配置步骤

刚做完使用DHlibxls读取Excel数据,结果花了好多积分下载下来的还是报各种错误,分享一下修改过程中的经验。
DHlibxls下载链接http://vdisk.weibo.com/s/aOwSyvKoljIp8
1.先将项目中重复的和不存的库文件删除,注意libDHxlsReaderiOS.a不用删除

iOS -DHlibxls读取Excel数据:下载链接及配置步骤_第1张图片
1.png

2.添加库文件:需要使用后缀为.dylib的文件,具体添加步骤如下:
Link Binary With Libraries点击+ ,然后选择Add Other


iOS -DHlibxls读取Excel数据:下载链接及配置步骤_第2张图片
2.png

然后点击command + shift + G 在输如框中输入/usr/lib


iOS -DHlibxls读取Excel数据:下载链接及配置步骤_第3张图片
3.png

然后选择需要的库文件
iOS -DHlibxls读取Excel数据:下载链接及配置步骤_第4张图片
8FB15BB8-3E4E-49F0-8B36-B3BF80B02D40.png
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"test.xls"];
//  NSString *path = @"/tmp/test.xls";

    // xls_debug = 1; // good way to see everything in the Excel file
    
    DHxlsReader *reader = [DHxlsReader xlsReaderFromFile:path];
    assert(reader);

    NSString *text = @"";
    
    text = [text stringByAppendingFormat:@"AppName: %@\n", reader.appName];
    text = [text stringByAppendingFormat:@"Author: %@\n", reader.author];
    text = [text stringByAppendingFormat:@"Category: %@\n", reader.category];
    text = [text stringByAppendingFormat:@"Comment: %@\n", reader.comment];
    text = [text stringByAppendingFormat:@"Company: %@\n", reader.company];
    text = [text stringByAppendingFormat:@"Keywords: %@\n", reader.keywords];
    text = [text stringByAppendingFormat:@"LastAuthor: %@\n", reader.lastAuthor];
    text = [text stringByAppendingFormat:@"Manager: %@\n", reader.manager];
    text = [text stringByAppendingFormat:@"Subject: %@\n", reader.subject];
    text = [text stringByAppendingFormat:@"Title: %@\n", reader.title];
    
 
    text = [text stringByAppendingFormat:@"\n\nNumber of Sheets: %u\n", reader.numberOfSheets];

#if 0
    [reader startIterator:0];
    
    while(YES) {
        DHcell *cell = [reader nextCell];
        if(cell.type == cellBlank) break;
        
        text = [text stringByAppendingFormat:@"\n%@\n", [cell dump]];
    }
#else
    int row = 2;
    while(YES) {
        DHcell *cell = [reader cellInWorkSheetIndex:0 row:row col:2];
        if(cell.type == cellBlank) break;        
        DHcell *cell1 = [reader cellInWorkSheetIndex:0 row:row col:3];
        NSLog(@"\nCell:%@\nCell1:%@\n", [cell dump], [cell1 dump]);
        row++;
        
        //text = [text stringByAppendingFormat:@"\n%@\n", [cell dump]];
        //text = [text stringByAppendingFormat:@"\n%@\n", [cell1 dump]];
    }
#endif

| |
| |


按照上面的这个教程修改的出现了问题

Skipped '.'
svn: E155007: None of the targets are working copies
Command /bin/sh failed with exit code 1

而且之前的DHlibxls下载地址不能下载了,下面是git的一个下载地址
https://github.com/dhoerl/DHlibxls
这个下载下来之后会报各种错误,以下是修改步骤。
1.先将项目中重复的和不存的库文件删除,.a文件不用管。
2.将缺少的文件添加。
3.targets -> build settings -> architectures -> build active architecture only -> debug 改成YES 。
完成以上步骤即可运行。
demo下载地址:https://gitee.com/bridgeworld/DHlibxls

你可能感兴趣的:(iOS -DHlibxls读取Excel数据:下载链接及配置步骤)