/// <summary> /// 寫入領域 Rows /// </summary> private void FillDomainRows() { Cell cell = _cell; Row row = _cell.ParentRow; Table table = row.ParentTable; int deleteIndex = table.IndexOf(row); int rowIndex = table.IndexOf(row); int SubjCount = 0; foreach (DomainRow domainRow in _manager.DomainRows) { SubjCount = 0; // 透過對照表查詢領域是否需要展開 bool display = DomainSubjectExpand.展開; if (_domains.ContainsKey(domainRow.Domain)) { display = _domains[domainRow.Domain]; } // 不展開,列印領域 if (display == DomainSubjectExpand.展開) { if (domainRow.Scores.Count <= 0) { continue; } table.Rows.Add(row.Clone(true)); Row tempRow = table.LastRow; WordHelper.MergeHorizontalCell(tempRow.Cells[0], 2); WordHelper.Write(tempRow.Cells[0], (string.IsNullOrEmpty(domainRow.Domain) ? "彈性課程" : domainRow.Domain), _builder); WriteDomain(tempRow.Cells[1], domainRow); } // 展開,列印科目 else { int subjectCount = 0; foreach (string subject in domainRow.SubjectScores.Keys) { subjectCount++; table.Rows.Add(row.Clone(true)); Row tempRow = table.LastRow; WordHelper.Write(tempRow.Cells[1], subject, _builder); WriteSubject(tempRow.Cells[1], domainRow.SubjectScores[subject]); } SubjCount = subjectCount; // 當只有領域成績沒有科目成績時 if (subjectCount > 0) { Row startRow = table.Rows[table.Rows.Count - subjectCount]; WordHelper.Write(startRow.Cells[0], (string.IsNullOrEmpty(domainRow.Domain) ? "彈性課程" : domainRow.Domain), _builder); if (subjectCount > 1) { WordHelper.MergeVerticalCell(startRow.Cells[0], subjectCount); } } } // 畢業成績 if (_StudGradScore.Domains.ContainsKey(domainRow.Domain)) { Row tmpRow = table.Rows[table.Rows.Count - SubjCount]; // 當科目數 >=1 if (SubjCount >= 1) { WordHelper.MergeVerticalCell(tmpRow.Cells[20], SubjCount); WordHelper.MergeVerticalCell(tmpRow.Cells[21], SubjCount); } else { tmpRow = table.LastRow; } //Row tmpRow = table.LastRow; if (_StudGradScore.Domains[domainRow.Domain].Score.HasValue) { // 分數 WordHelper.Write(tmpRow.Cells[20], _StudGradScore.Domains[domainRow.Domain].Score.Value.ToString(), _builder); // 等第 WordHelper.Write(tmpRow.Cells[21], DegreeMapper.GetDegreeByScore(_StudGradScore.Domains[domainRow.Domain].Score.Value), _builder); } } } table.Rows[deleteIndex].Remove(); // 畫底出線 foreach (Cell c in table.LastRow.Cells) { c.CellFormat.Borders.Bottom.LineWidth = 1.5; } //bool hasScore = false; //Cell cell = _cell; //Cell gradCell1 = GetMoveRightCell(cell, GraduateShift); //Cell gradCell2 = GetMoveRightCell(cell, GraduateShift + 1); //int first_row_index = _cell.ParentRow.ParentTable.IndexOf(_cell.ParentRow); //foreach (DomainRow row in _manager.DomainRows) //{ // // 透過對照表查詢領域是否需要展開 // bool display = DomainSubjectExpand.展開; // if (_domains.ContainsKey(row.Domain)) // display = _domains[row.Domain]; // hasScore = true; // //int count = row.Count; // Write(cell, string.IsNullOrEmpty(row.Domain) ? "彈性課程" : row.Domain); // // 不展開,列印領域 // if (display == DomainSubjectExpand.不展開) // { // MergeVerticalCell(cell, count); // MergeVerticalCell(gradCell1, count); // MergeVerticalCell(gradCell2, count); // } // // 展開,列印科目 // else // { // Cell subjectCell = GetMoveRightCell(cell, 1); // foreach (SubjectRow subjectRow in row.SubjectRows) // { // WriteSubject(subjectCell, subjectRow); // subjectCell = GetMoveDownCell(subjectCell, 1); // if (subjectCell == null) break; // } // } // cell = GetMoveDownCell(cell, count); // gradCell1 = GetMoveDownCell(gradCell1, count); // gradCell2 = GetMoveDownCell(gradCell2, count); // if (cell == null) break; //} //if (hasScore) //{ // do // { // cell.CellFormat.VerticalMerge = CellMerge.Previous; // cell = GetMoveDownCell(cell, 1); // gradCell1.CellFormat.VerticalMerge = CellMerge.Previous; // gradCell1 = GetMoveDownCell(gradCell1, 1); // gradCell2.CellFormat.VerticalMerge = CellMerge.Previous; // gradCell2 = GetMoveDownCell(gradCell2, 1); // } // while (cell != null); //} }