// //导入模板——删除 // private void btn_Inpu_Delete_SN_Click(object sender, RoutedEventArgs e) { ZhuifengLib.EXCEL.ExcelControl _M_excel = new ZhuifengLib.EXCEL.ExcelControl(); lst_DeleteList.Items.Clear(); lab_DeleteRecord.Text = "0"; DataSet temds = new DataSet(); temds = _M_excel.ExcelReader("D:\\模板\\DeleteListTemplate.xlsx"); if (temds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in temds.Tables[0].Rows) { Add_DeleteSN_To_List(dr["SN"].ToString()); } } lab_DeleteRecord.Text = lst_DeleteList.Items.Count.ToString(); //让滚动条自动滚东到底部 lst_DeleteList.UpdateLayout();//此句是关键 //如果不加上面那句的话,不会滚动到最底端,最后一个控件会看不见,加了上面这句刷新下ListBox的布局,就可以滚动到最底端了 lst_DeleteList.ScrollIntoView(lst_DeleteList.Items[lst_DeleteList.Items.Count - 1]); }
/// <summary> /// 获取来自Excel中的工序列表 /// </summary> /// <param name="eFlowList_Contents"></param> /// <param name="DrawNum"></param> public void GetDraw_forExcel(ref ObservableCollection <Maticsoft.Model.e_Flow> eFlowList_Contents) { ZhuifengLib.EXCEL.ExcelControl _M_excel = new ZhuifengLib.EXCEL.ExcelControl(); DataSet temds = _M_excel.ExcelReader(_ExcelPatch); eFlowList_Contents.Clear(); ZhuifengLib.Model.ModelHandler <Maticsoft.Model.e_Flow> te = new ZhuifengLib.Model.ModelHandler <Model.e_Flow>(); foreach (Maticsoft.Model.e_Flow tem in M_Flow.DataTableToList(temds.Tables[0])) { eFlowList_Contents.Add(tem); } }
private void button1_Click(object sender, System.Windows.RoutedEventArgs e) { ZhuifengLib.EXCEL.ExcelControl _excelcontrol = new ZhuifengLib.EXCEL.ExcelControl(); DataSet Temds = new DataSet(); Temds = _excelcontrol.ExcelReader("D:\\模板\\DeleteListTemplate.xlsx"); int t = 0; foreach (DataRow dr in Temds.Tables[0].Rows) { string _pigtailsn = dr["SN"].ToString(); InspectSN("", _pigtailsn); t++; lab_Count_Show.Content = t + "/" + Temds.Tables[0].Rows.Count; } My_MessageBox.My_MessageBox_Message("终于结束了!"); }