private void Export_Load(object sender, EventArgs e) { cell = excelio.getInstance(); cell.openfile(filePath); checkdate = cell.gettimes(); classname = cell.getclassname(); foreach (String item in checkdate) { ComboBoxItem cbi = new ComboBoxItem(); cbi.Text = item; cbi.Value = list; dateselect.Items.Add(cbi); list++; } }
private void Roll1_Load(object sender, EventArgs e) { checkBox1.Enabled = false; cell = excelio.getInstance(); //MessageBox.Show(filePath); cell.openfile(filePath); namelist = cell.readfile(); studentnum = cell.getstudentnum(); this.Owner.Visible = false; //String classname = cell.getclassname(); //int[] position = cell.find(1131000078); //cell.mark(1131000078, 1); //int week = cell.getweek(); //cell.settime(1); //cell.save(); }
private void absence_Load(object sender, EventArgs e) { groupBox1.Visible = false; groupBox2.Visible = false; groupBox3.Visible = false; button1.Enabled = false; button2.Enabled = false; excelio cell = excelio.getInstance(); if (filePath != null) { cell.openfile(filePath); if (absence != null) { button2.Enabled = true; foreach (long sn in absence) { absinfo.Add(new info(cell.getstudentname(sn), sn, cell.getabsencenum(sn))); } if (absinfo.Count >= 3) { if (absinfo.Count == 3) { button2.Enabled = false; } for (i = 0; i < 3; i++) { info student = (info)absinfo[i]; fresh(student, i); } } else { button2.Enabled = false; for (i = 0; i < absinfo.Count; i++) { info student = (info)absinfo[i]; fresh(student, i); } } } } }
private void button2_Click(object sender, EventArgs e) { excelio cell = excelio.getInstance(); if (absence == null) { absence = new ArrayList(); } Absenceform form = new Absenceform(); form.Owner = this; form.absset(absence); if (fileselect.Items.Count != 0) { cell.openfile((fileselect.SelectedItem as ComboBoxItem).Value.ToString()); form.excelpath((fileselect.SelectedItem as ComboBoxItem).Value.ToString()); } this.Visible = false; form.Show(); }
private void button1_Click(object sender, EventArgs e) { excelio cell = excelio.getInstance(); if (absence != null) { absence.Clear(); } String filepath = (fileselect.SelectedItem as ComboBoxItem).Value.ToString(); if (classname != null) { cell.openfile(filepath); filepath = filepath.Substring(0, filepath.LastIndexOf("\\") + 1) + Encoding.UTF8.GetString(System.Convert.FromBase64String(classname)); } if (num == 1) { Roll1 form = new Roll1(); //form.absset(absence); form.excelpath((fileselect.SelectedItem as ComboBoxItem).Value.ToString()); form.Owner = this; form.Show(); } if (num == 2) { Roll2 form = new Roll2(); //form.absset(absence); form.excelpath((fileselect.SelectedItem as ComboBoxItem).Value.ToString()); form.Owner = this; form.Show(); } if (num == 4) { Roll4 form = new Roll4(); //form.absset(absence); form.excelpath((fileselect.SelectedItem as ComboBoxItem).Value.ToString()); form.Owner = this; form.Show(); } }
private void button1_Click(object sender, EventArgs e) { ArrayList abssttdbydate = new ArrayList(); if (dateselect.CheckedItems.Count != 0) { int first = dateselect.CheckedIndices[0]; int last = dateselect.CheckedIndices.IndexOf(dateselect.CheckedIndices.Count - 1); if ((last - first) >= dateselect.CheckedItems.Count) { MessageBox.Show("暂只支持连续输出"); return; } foreach (ComboBoxItem date in dateselect.CheckedItems) { ArrayList absstdbysn = new ArrayList(); foreach (student st in cell.getabsstu((int)date.Value + 9, first, last)) { absstdbysn.Add(st); } if (absstdbysn.Count != 0) { abssttdbydate.Add(new KeyValuePair <ArrayList, KeyValuePair <String, int> >(absstdbysn, new KeyValuePair <String, int>(date.Text, dateselect.Items.IndexOf(date)))); } }//将旧表信息提取 Workbook workbook = cell.newworkbook(); cell = cell.newcells(workbook); int j = 1, k = 3; cell.setstr("序号", 1, 0); cell.setstr("学号", 1, 1); cell.setstr("姓名", 1, 2); cell.setstr("缺勤次数", 1, 3); foreach (KeyValuePair <ArrayList, KeyValuePair <String, int> > absstdbysns in abssttdbydate) { ArrayList absstdbysn = absstdbysns.Key; KeyValuePair <String, int> dates = absstdbysns.Value; cell.setstr("第" + (dates.Value + 1) + "次", 0, k + 1); cell.setstr(dates.Key, 1, k + 1); foreach (student st in absstdbysn) { if (cell.find(st.Sn) != null) { int temp = j; j = cell.find(st.Sn)[0]; cell.setstr(st.Serial.ToString(), j, 0); cell.setstr(st.Sn.ToString(), j, 1); cell.setstr(st.Name, j, 2); cell.setstr("缺勤", j, k + 1); j = temp; } else { j++; cell.setstr(st.Abs.ToString(), j, 3); cell.setstr(st.Serial.ToString(), j, 0); cell.setstr(st.Sn.ToString(), j, 1); cell.setstr(st.Name, j, 2); cell.setstr("缺勤", j, k + 1); } } k++; } k = 0; /*foreach (ComboBoxItem date in dateselect.CheckedItems) * { * cell.setstr(date.Text, 1, k+4); * k++; * }*/ cell.sort(3); cell.save(Application.StartupPath + "\\" + classname + "_点名记录.xls"); MessageBox.Show("导出成功"); cell.openfile(filePath); this.Close(); } else { MessageBox.Show("未选则输出日期"); } }