private void ProcessAttendance() { Dictionary <string, AttendanceItemRow> items = new Dictionary <string, AttendanceItemRow>(); foreach (AutoSummaryRecord record in _list) { SemesterData semester = new SemesterData("" + record.SchoolYear, "" + record.Semester); foreach (AbsenceCountRecord absence in record.AbsenceCounts) { if (!items.ContainsKey(absence.PeriodType + ":" + absence.Name)) { items.Add(absence.PeriodType + ":" + absence.Name, new AttendanceItemRow(absence.PeriodType, absence.Name)); } items[absence.PeriodType + ":" + absence.Name].Add(semester, absence.Count); } } Row row = _cell.ParentRow; Table table = row.ParentTable; int rowIndex = table.IndexOf(row); if (_types.Count <= 0) { row.Remove(); return; } int typeCount = 0; foreach (string type in _types.Keys) { int nameCount = 0; foreach (string name in _types[type]) { nameCount++; typeCount++; table.Rows.Insert(++rowIndex, row.Clone(true)); Row tempRow = table.Rows[rowIndex]; Write(tempRow.Cells[2], name); if (items.ContainsKey(type + ":" + name)) { WriteAttendanceItemRow(tempRow.Cells[3], items[type + ":" + name]); } } Cell nameCell = table.Rows[rowIndex - nameCount + 1].Cells[1]; WordHelper.MergeVerticalCell(nameCell, nameCount); Write(nameCell, type); } Cell typeCell = table.Rows[rowIndex - typeCount + 1].Cells[0]; WordHelper.MergeVerticalCell(typeCell, typeCount); Write(typeCell, "缺曠資料"); row.Remove(); }
private void FillDomainRows() { Cell cell = _cell; Row row = _cell.ParentRow; Table table = row.ParentTable; int rowIndex = table.IndexOf(row); foreach (DomainRow domainRow in _manager.DomainRows) { // 當有領域沒有科目成績 if (domainRow.SubjectScores.Count <= 0) { // 沒有領域成績 if (domainRow.Scores.Count <= 0) { continue; } // 當使用者選擇科目又沒科目成績 if (_config.DomainSubjectSetup == "Subject" && domainRow.SubjectScores.Count == 0) { continue; } table.Rows.Add(row.Clone(true)); Row tempRow = table.LastRow; WordHelper.MergeHorizontalCell(tempRow.Cells[0], 2); Write(tempRow.Cells[0], string.IsNullOrEmpty(domainRow.Domain) ? "彈性課程" : domainRow.Domain); // 當使用者選科目時,不列印領領域成績 if (_config.DomainSubjectSetup == "Domain") { WriteDomain(tempRow.Cells[1], domainRow); } } else { int subjectCount = 0; foreach (string subject in domainRow.SubjectScores.Keys) { subjectCount++; //table.Rows.Insert(rowIndex++, table.Rows[deleteIndex].Clone(true) as Row); //Row tempRow = table.Rows[rowIndex]; table.Rows.Add(row.Clone(true)); Row tempRow = table.LastRow; Write(tempRow.Cells[1], subject); WriteSubject(tempRow.Cells[1], domainRow.SubjectScores[subject]); } Row startRow = table.Rows[table.Rows.Count - subjectCount]; Write(startRow.Cells[0], string.IsNullOrEmpty(domainRow.Domain)? "彈性課程" : domainRow.Domain); if (subjectCount > 1) { WordHelper.MergeVerticalCell(startRow.Cells[0], subjectCount); } } } row.Remove(); //Cell typeCell = table.Rows[rowIndex - typeCount + 1].Cells[0]; //WordHelper.MergeVerticalCell(typeCell, typeCount); //Write(typeCell, "缺曠資料"); //Cell cell = _cell; //int first_row_index = _cell.ParentRow.ParentTable.IndexOf(_cell.ParentRow); //int count = 0; //foreach (DomainRow row in _manager.DomainRows) //{ // WriteDomain(cell, row); // cell = WordHelper.GetMoveDownCell(cell, 1); // if (cell == null) break; // if (++count == 2) // cell = WordHelper.GetMoveLeftCell(cell, 1); //} }