剛做完使用DHlibxls讀取Excel數(shù)據(jù),結(jié)果花了好多積分下載下來(lái)的還是報(bào)各種錯(cuò)誤,分享一下修改過(guò)程中的經(jīng)驗(yàn)。
DHlibxls下載鏈接http://vdisk.weibo.com/s/aOwSyvKoljIp8
1.先將項(xiàng)目中重復(fù)的和不存的庫(kù)文件刪除,注意libDHxlsReaderiOS.a不用刪除
2.添加庫(kù)文件:需要使用后綴為.dylib的文件,具體添加步驟如下:
Link Binary With Libraries點(diǎn)擊+ ,然后選擇Add Other
然后點(diǎn)擊command + shift + G 在輸如框中輸入/usr/lib
然后選擇需要的庫(kù)文件
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
| |
| |
按照上面的這個(gè)教程修改的出現(xiàn)了問(wèn)題
Skipped '.'
svn: E155007: None of the targets are working copies
Command /bin/sh failed with exit code 1
而且之前的DHlibxls下載地址不能下載了,下面是git的一個(gè)下載地址
https://github.com/dhoerl/DHlibxls
這個(gè)下載下來(lái)之后會(huì)報(bào)各種錯(cuò)誤,以下是修改步驟。
1.先將項(xiàng)目中重復(fù)的和不存的庫(kù)文件刪除,.a文件不用管。
2.將缺少的文件添加。
3.targets -> build settings -> architectures -> build active architecture only -> debug 改成YES 。
完成以上步驟即可運(yùn)行。
demo下載地址:https://gitee.com/bridgeworld/DHlibxls