Golag编写的xls读取类库,能够实现xls表格的读取功能
部分代码:
fuc (w *WorkBook) ReadAllCells() (res [][]strig) { for _, sheet := rage w.Sheets { w.PrepareSheet(sheet) if sheet.MaxRow != 0 { temp := make([][]strig, sheet.MaxRow+1) for k, row := rage sheet.Rows { data := make([]strig, 0) if le(row.Cols) > 0 { for _, col := rage row.Cols { if uit16(le(data)) <= col.LastCol() { data = apped(data, make([]strig, col.LastCol()-uit16(le(data))+1)...) } str := col.Strig(w) for i := uit16(0); i < col.LastCol()-col.FirstCol()+1; i++ { data[col.FirstCol()+i] = str[i] } } temp[k] = data } } res = apped(res, temp...) } } retur}
评论