private void fillParticipants(WordHelper helper, SocialProject project) { DataClassesDataContext dc = new DataClassesDataContext(); var participants = dc.ApplicantMember.Where(am => am.F_applicantID.Equals(project.F_ID)).OrderBy(am => am.F_seq); if (helper.FindCell("F_firstParticipant")) { for (int i = 0; i < participants.Count() - 5; i++) { helper.CreateNewRow(); } helper.FindCell("F_firstParticipant"); int index = 0; int count = participants.Count(); foreach (ApplicantMember member in participants) { index++; helper.SetCellValue(member.F_realName); helper.MoveNextCell(); helper.SetCellValue(member.F_sexual); helper.MoveNextCell(); if (member.F_birthday != null) { helper.SetCellValue(member.F_birthday.Value.ToShortDateString()); } helper.MoveNextCell(); helper.SetCellValue(member.F_title); helper.MoveNextCell(); helper.SetCellValue(member.F_expert); helper.MoveNextCell(); helper.SetCellValue(member.F_education); helper.MoveNextCell(); helper.SetCellValue(member.F_degree); helper.MoveNextCell(); helper.SetCellValue(member.F_workspace); if (index < count) { helper.MoveNextCell(); } } } }