private void load_excel_2_grid(C1.Win.C1FlexGrid.C1FlexGrid m_fg) { var m_obj_dialog = new System.Windows.Forms.OpenFileDialog(); DialogResult v_result = new DialogResult(); v_result = m_obj_dialog.ShowDialog(); if(v_result == DialogResult.Cancel) { BaseMessages.MsgBox_Infor("Bạn chưa chọn file Excel!"); m_obj_dialog.Dispose(); return; } Workbook wb = null; wb = Workbook.getWorkbook(m_obj_dialog.FileName); Sheet sheet = wb.getSheet(0); //Cái này để thêm hàng vào grid int v_count_row = 7; while(sheet.getCell(2, v_count_row).Contents != "") { v_count_row = v_count_row + 1; m_fg.Rows.Add(); } wb.close(); Hashtable v_hst_excel_col = get_mapping_col_excel_grid(); CExcelReport v_obj_excel_rpt = new CExcelReport(m_obj_dialog.FileName); int v_i_start_excel_row = 7; for(int v_i_cur_col = m_fg.Cols.Fixed; v_i_cur_col < m_fg.Cols.Count; v_i_cur_col++) { m_lbl_loading.Visible = true; progressBar1.Visible = true; progressBar1.Minimum = m_fg.Cols.Fixed; progressBar1.Maximum = m_fg.Cols.Count; progressBar1.Value = v_i_cur_col; v_obj_excel_rpt.Export2Grid(m_fg, v_i_start_excel_row , (int)v_hst_excel_col[v_i_cur_col] , v_i_cur_col); } m_lbl_tong_so_bill.Text = CIPConvert.ToStr(count_record_in_grid(m_fg)); make_stt(m_fg); m_lbl_loading.Visible = false; progressBar1.Visible = false; m_fg.Select(0, 0); }