private static string cell(ISheet isheet_0, int row_num, int cell_num) { string str; IRow row = isheet_0.GetRow(row_num); str = (row != null ? ExeclUtil.read_cell(row.GetCell(cell_num)) : ""); return(str); }
public static ArrayList query_order_list(CmsForm cmsForm, string string_0, out string out_log) { out_log = ""; ArrayList arrayLists = new ArrayList(); HSSFWorkbook hSSFWorkbook = null; try { try { FileStream fileStream = new FileStream(string_0, FileMode.Open, FileAccess.Read); hSSFWorkbook = new HSSFWorkbook(fileStream); ISheet sheetAt = hSSFWorkbook.GetSheetAt(0); if (File.Exists(string_0)) { IRow row = sheetAt.GetRow(0); //读取当前行数据 //LastRowNum 是当前表的总行数-1(注意) //int offset = 0; for (int i = 0; i <= sheetAt.LastRowNum; i++) { row = sheetAt.GetRow(i); //读取当前行数据 if (row != null) { AliOrderBean aliOrderBean = new AliOrderBean(); aliOrderBean.order_time = ExeclUtil.read_cell(row.GetCell(0)); aliOrderBean.click_time = ExeclUtil.read_cell(row.GetCell(1)); aliOrderBean.title = ExeclUtil.read_cell(row.GetCell(2)); aliOrderBean.num_iid = ExeclUtil.read_cell(row.GetCell(3)); aliOrderBean.nick = ExeclUtil.read_cell(row.GetCell(4)); aliOrderBean.shop_title = ExeclUtil.read_cell(row.GetCell(5)); aliOrderBean.product_num = ExeclUtil.read_cell(row.GetCell(6)); aliOrderBean.product_price = ExeclUtil.read_cell(row.GetCell(7)); aliOrderBean.status = ExeclUtil.read_cell(row.GetCell(8)); aliOrderBean.order_type = ExeclUtil.read_cell(row.GetCell(9)); aliOrderBean.commission_rate = ExeclUtil.read_cell(row.GetCell(10)); aliOrderBean.fen_rate = ExeclUtil.read_cell(row.GetCell(11)); aliOrderBean.price = ExeclUtil.read_cell(row.GetCell(12)); aliOrderBean.commission = ExeclUtil.read_cell(row.GetCell(13)); aliOrderBean.settlement_price = ExeclUtil.read_cell(row.GetCell(14)); aliOrderBean.settlement_money = ExeclUtil.read_cell(row.GetCell(15)); aliOrderBean.settlement_date = ExeclUtil.read_cell(row.GetCell(16)); aliOrderBean.product_rate = ExeclUtil.read_cell(row.GetCell(17)); aliOrderBean.product_money = ExeclUtil.read_cell(row.GetCell(18)); aliOrderBean.benefit_rate = ExeclUtil.read_cell(row.GetCell(19)); aliOrderBean.benefit_money = ExeclUtil.read_cell(row.GetCell(20)); aliOrderBean.benefit_type = ExeclUtil.read_cell(row.GetCell(21)); aliOrderBean.order_platform = ExeclUtil.read_cell(row.GetCell(22)); aliOrderBean.third_party_service = ExeclUtil.read_cell(row.GetCell(23)); aliOrderBean.order_no = ExeclUtil.read_cell(row.GetCell(24)); aliOrderBean.cate_name = ExeclUtil.read_cell(row.GetCell(25)); aliOrderBean.site_id = ExeclUtil.read_cell(row.GetCell(26)); aliOrderBean.site_name = ExeclUtil.read_cell(row.GetCell(27)); aliOrderBean.zone_id = ExeclUtil.read_cell(row.GetCell(28)); aliOrderBean.zone_name = ExeclUtil.read_cell(row.GetCell(29)); //LastCellNum 是当前行的总列数 //for (int j = 0; j < row.LastCellNum; j++) //{ // //读取该行的第j列数据 // string value = row.GetCell(j).ToString(); // LogUtil.log_call(cmsForm, "value" + value.ToString()); //} arrayLists.Add(aliOrderBean); //LogUtil.log_call(cmsForm, "zone_name:" + aliOrderBean.zone_name.ToString()); } } } fileStream.Close(); } catch (Exception exception) { LogUtil.log_call(cmsForm, "exception" + exception.ToString()); } } finally { ExeclUtil.close(hSSFWorkbook); } return(arrayLists); }