//论文封面检测 public void detectCoverStyle(List <Paragraph> list, WordprocessingDocument doc) { Tools.Util.printError("封面检测"); Util.printError("----------------------------------------------"); if (list.Count <= 0) { if (bool.Parse(coverstyleHeadline[0])) { Util.printError("论文缺少封面部分"); } } else { int i = -1; //封面大标题 while (true) { i++; if (i > 100 || Util.getFullText(list[i]).Trim().Length != 0) { break; } } string CovHeadline = Util.getFullText(list[i]).Replace(" ", ""); if (MasterType == "专业学位硕士") { if (CovHeadline != "专业学位硕士学位论文") { Util.printError("论文类型" + "“" + CovHeadline + "”" + "错误,专业学位硕士应为“专业学位硕士学位论文”"); } } if (MasterType == "学术型硕士") { if (CovHeadline != "硕士学位论文") { Util.printError("论文类型" + "“" + CovHeadline + "”" + "错误,学术型硕士论文应为“硕士学位论文”"); } } if (!(Util.getFullText(list[i]).Trim().Length - 6 == int.Parse(coverstyleHeadline[1]) || Util.getFullText(list[i]).Trim().Length - 10 == int.Parse(coverstyleHeadline[1]) + 4)) { Util.printError("论文类型" + "“" + CovHeadline + "”" + "每个字之间应包含一个空格"); } if (!Util.correctJustification(list[i], doc, coverstyleHeadline[2])) { Util.printError("论文类型" + "“" + CovHeadline + "”" + "未居中"); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleHeadline[6])) { Util.printError("论文类型" + "“" + CovHeadline + "”" + "行间距错误,应为" + Util.DSmap[coverstyleHeadline[6]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleHeadline[7])) { Util.printError("论文类型" + "“" + CovHeadline + "”" + "段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleHeadline[8])) { Util.printError("论文类型" + "“" + CovHeadline + "”" + "段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleHeadline[3], "Times New Roman")) { Util.printError("论文类型" + "“" + CovHeadline + "”" + "字体错误,应为" + coverstyleHeadline[3]); } if (!Util.correctsize(list[i], doc, coverstyleHeadline[4])) { Util.printError("论文类型" + "“" + CovHeadline + "”" + "字号错误,应为" + coverstyleHeadline[4]); } if (!Util.correctBold(list[i], doc, bool.Parse(coverstyleHeadline[5]))) { if (bool.Parse(coverstyleHeadline[5])) { Util.printError("论文类型" + "“" + CovHeadline + "”" + "未加粗"); } else { Util.printError("论文类型" + "“" + CovHeadline + "”" + "不需加粗"); } } //封面中文小标题 while (true) { i++; if (i > 100 || Util.getFullText(list[i]).Trim().Length != 0) { break; } } string SubChText = Util.getFullText(list[i]).Replace(" ", "").Trim(); int SubChWordNum = Util.getFullText(list[i]).Replace(" ", "").Trim().Length; for (int j = 0; j < Util.getFullText(list[i]).Replace(" ", "").Trim().Length; j++) { if ((SubChText[j] >= 48 && SubChText[j] <= 57) || (SubChText[j] >= 65 && SubChText[j] <= 90) || (SubChText[j] >= 97 && SubChText[j] <= 122)) { int k = 0; int m = j; for (; ; m++) { if (!((SubChText[m] >= 48 && SubChText[m] <= 57) || (SubChText[m] >= 65 && SubChText[m] <= 90) || (SubChText[m] >= 97 && SubChText[m] <= 122))) { break; } k++; } SubChWordNum = SubChWordNum - k + 1; j = m; } } if (SubChWordNum > int.Parse(coverstyleSubtitleCh[0])) { Util.printError("论文中文标题字数超过20个"); } if (!Util.correctJustification(list[i], doc, coverstyleSubtitleCh[1])) { Util.printError("论文中文标题未居中"); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleSubtitleCh[5])) { Util.printError("论文中文标题行间距错误,应为" + Util.DSmap[coverstyleSubtitleCh[5]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleSubtitleCh[6])) { Util.printError("论文中文标题段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleSubtitleCh[7])) { Util.printError("论文中文标题段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleSubtitleCh[2], "Times New Roman")) { Util.printError("论文中文标题字体错误,应为" + coverstyleSubtitleCh[2]); } if (!Util.correctsize(list[i], doc, coverstyleSubtitleCh[4])) { Util.printError("论文中文标题字号错误,应为" + coverstyleSubtitleCh[4]); } if (!Util.correctBold(list[i], doc, bool.Parse(coverstyleSubtitleCh[3]))) { if (bool.Parse(coverstyleSubtitleCh[3])) { Util.printError("论文中文标题未加粗"); } else { Util.printError("论文中文标题不需加粗"); } } //检测封面中文小标题之间是否有多余转行 while (true) { i++; if (i > 100 || Util.getFullText(list[i]).Trim().Length != 0) { break; } } //string cnoren_subtitletext = util.getfulltext(list[i]).replace(" ", ""); //if (!((cnoren_subtitletext[0] >= 65 && cnoren_subtitletext[0] <= 90) || (cnoren_subtitletext[0] >= 97 && cnoren_subtitletext[0] <= 122))) // util.printerror("封面中文小标题中间不应该有转行"); //封面英文小标题 string EnSubtitleString; while (true) { EnSubtitleString = Util.getFullText(list[i]).Replace(" ", ""); if ((EnSubtitleString[0] >= 65 && EnSubtitleString[0] <= 90) || (EnSubtitleString[0] >= 97 && EnSubtitleString[0] <= 122)) { break; } i++; if (i > 100) { break; } } if (!Util.correctJustification(list[i], doc, coverstyleSubtitleEn[0])) { Util.printError("论文英文标题未居中"); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleSubtitleEn[4])) { Util.printError("论文英文标题行间距错误,应为" + Util.DSmap[coverstyleSubtitleEn[4]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleSubtitleEn[5])) { Util.printError("论文英文标题段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleSubtitleEn[6])) { Util.printError("论文英文标题段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, "Times New Roman", coverstyleSubtitleEn[1])) { Util.printError("论文英文标题字体错误,应为" + coverstyleSubtitleEn[1]); } if (!Util.correctsize(list[i], doc, coverstyleSubtitleEn[3])) { Util.printError("论文英文标题字号错误,应为" + coverstyleSubtitleEn[3]); } if (!Util.correctBold(list[i], doc, bool.Parse(coverstyleSubtitleEn[2]))) { if (bool.Parse(coverstyleSubtitleEn[2])) { Util.printError("论文英文标题未加粗"); } else { Util.printError("论文英文标题不需加粗"); } } //英文小标题字母大小写的检测 string[] CapitalEmptyWord = { "A", "Above", "An", "As", "Behind", "But", "Before", "If", "The", "At", "For", "From", "Of", "Off", "On", "To", "In", "With", "And", "As", "While", "So" }; string[] SmallEmptyWord = { "a", "above", "an", "as", "behind", "but", "before", "if", "the", "at", "for", "from", "of", "off", "on", "to", "in", "with", "and", "as", "while", "so" }; string SubtitleEnText = Util.getFullText(list[i]); int SubtitleEnTextLength = Util.getFullText(list[i]).Trim().Length; if (!(SubtitleEnText[0] >= 65 && SubtitleEnText[0] <= 90)) { Util.printError("论文英文题目句首的单词首字母未大写"); } int LastSpaceInText = SubtitleEnText.LastIndexOf(' '); int NumInText = 0; bool IsHaveEmptyWord = false; for (; NumInText < SubtitleEnTextLength; NumInText++) { if (SubtitleEnText[NumInText] == ' ' && NumInText < LastSpaceInText) { string Word = ""; bool IsWordEmpty = true; bool WordFlag = true; int a = SubtitleEnText.IndexOf(' ', NumInText + 1); Word = SubtitleEnText.Substring(NumInText + 1, a - NumInText - 1); if (a - NumInText - 1 > 0) { IsWordEmpty = false; } else { IsHaveEmptyWord = true; } foreach (string S in CapitalEmptyWord) { if (Word == S) { Util.printError("论论文英文题目非句首虚词首字母不应大写" + " ----" + Word); } } foreach (string C in SmallEmptyWord) { if (Word == C) { WordFlag = false; } } if (WordFlag && !IsWordEmpty) { if (!(Word[0] >= 65 && Word[0] <= 90) && Word.IndexOf("(") == -1) { Util.printError("论文英文标题实词首字母未大写" + " ----" + Word); } } } if (SubtitleEnText[NumInText] == ' ' && NumInText == LastSpaceInText) { bool WordFlag = true; string Word = SubtitleEnText.Substring(NumInText + 1); foreach (string S in CapitalEmptyWord) { if (Word == S) { Util.printError("论论文英文题目非句首虚词首字母不应大写" + " ----" + Word); } } foreach (string C in SmallEmptyWord) { if (Word == C) { WordFlag = false; } } if (WordFlag) { if (Word[0] != '\0') { if (!(Word[0] >= 65 && Word[0] <= 90) && Word.IndexOf("(") == -1) { Util.printError("论文英文标题实词首字母未大写" + " ----" + Word); } } } } } if (IsHaveEmptyWord) { Util.printError("论文英文题目里单词间含有多余的空格"); } //检测封面英文小标题之间是否有多余转行 while (true) { i++; if (i > 100 || Util.getFullText(list[i]).Trim().Length != 0) { break; } } //string SubOrStuInformationText = Util.getFullText(list[i]).Replace(" ", ""); //if ((SubOrStuInformationText[0] >= 65 && SubOrStuInformationText[0] <= 90) || (SubOrStuInformationText[0] >= 97 && SubOrStuInformationText[0] <= 122)) // Util.printError("封面英文小标题中间不应该有转行"); //封面学生信息 string StuInformationString; int NumLost = 0; while (true) { StuInformationString = Util.getFullText(list[i]).Replace(" ", ""); if (Util.getFullText(list[i]).Trim().Length != 0 && !((StuInformationString[0] >= 65 && StuInformationString[0] <= 90) || (StuInformationString[0] >= 97 && StuInformationString[0] <= 122))) { break; } i++; if (i > 100) { break; } } int FirstStuInformation = i; int StuInformationLine = 0; string[] Z_EachStuInformation = new string[] { "作者姓名", "工程领域", "学号", "指导教师", "完成日期" }; string[] X_EachStuInformation = new string[] { "作者姓名", "学科、专业", "学号", "指导教师", "完成日期" }; for (; i <= FirstStuInformation + 4; i++) { StuInformationLine++; StuInformationString = Util.getFullText(list[i]).Replace(" ", ""); if (Util.getFullText(list[i]).Trim().Length != 0) { if (MasterType == "专业学位硕士") { if (StuInformationString.IndexOf(Z_EachStuInformation[i - FirstStuInformation]) == -1) { Util.printError("第" + StuInformationLine + "学生信息应为:" + Z_EachStuInformation[i - FirstStuInformation]); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleStuInformation[4])) { Util.printError("学生信息中" + "“" + Z_EachStuInformation[i - FirstStuInformation] + "”" + "行行间距错误,应为" + Util.DSmap[coverstyleStuInformation[4]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleStuInformation[5])) { Util.printError("学生信息中" + "“" + Z_EachStuInformation[i - FirstStuInformation] + "”" + "行学生信息段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleStuInformation[6])) { Util.printError("学生信息中" + "“" + Z_EachStuInformation[i - FirstStuInformation] + "”" + "行学生信息段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleStuInformation[1], "Times New Roman")) { Util.printError("学生信息中" + "“" + Z_EachStuInformation[i - FirstStuInformation] + "”" + "行学生信息字体错误,应为" + coverstyleStuInformation[1]); } if (!Util.correctsize(list[i], doc, coverstyleStuInformation[3])) { Util.printError("学生信息中" + "“" + Z_EachStuInformation[i - FirstStuInformation] + "”" + "行学生信息字号错误,应为" + coverstyleStuInformation[3]); } } if (MasterType == "学术型硕士") { if (StuInformationString.IndexOf(X_EachStuInformation[i - FirstStuInformation]) == -1) { Util.printError("第" + StuInformationLine + "学生信息应为:" + X_EachStuInformation[i - FirstStuInformation]); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleStuInformation[4])) { Util.printError("学生信息中" + "“" + X_EachStuInformation[i - FirstStuInformation] + "”" + "行行间距错误,应为" + Util.DSmap[coverstyleStuInformation[4]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleStuInformation[5])) { Util.printError("学生信息中" + "“" + X_EachStuInformation[i - FirstStuInformation] + "”" + "行学生信息段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleStuInformation[6])) { Util.printError("学生信息中" + "“" + X_EachStuInformation[i - FirstStuInformation] + "”" + "行学生信息段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleStuInformation[1], "Times New Roman")) { Util.printError("学生信息中" + "“" + X_EachStuInformation[i - FirstStuInformation] + "”" + "行学生信息字体错误,应为" + coverstyleStuInformation[1]); } if (!Util.correctsize(list[i], doc, coverstyleStuInformation[3])) { Util.printError("学生信息中" + "“" + X_EachStuInformation[i - FirstStuInformation] + "”" + "行学生信息字号错误,应为" + coverstyleStuInformation[3]); } } } else { NumLost++; } } if (NumLost != 0) { Util.printError("学生信息有" + NumLost + "行缺省"); } //封面第二项学生信息 专硕 和 工硕 差别的检测 /* String SecondStuInformation = Util.getFullText(list[FirstStuInformation + 1]).Replace(" ", ""); * if (MasterType == "专业学位硕士") * { * if (SecondStuInformation.IndexOf("工程领域") == -1) * Util.printError("工程硕士第二项应为工程领域"); * } * if (MasterType == "学术型硕士") * { * if (SecondStuInformation.IndexOf("学科、专业") == -1) * Util.printError("除工程硕士外其他专业硕士第二项应为学科、专业"); * }*/ //封面中文学校名 while (true) { i++; if (i > 100 || Util.getFullText(list[i]).Trim().Length != 0) { break; } } if (!Util.correctJustification(list[i], doc, coverstyleSchoolNameCh[1])) { Util.printError("封面中文学校名未居中"); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleSchoolNameCh[3])) { Util.printError("封面中文学校名行间距错误,应为" + Util.DSmap[coverstyleSchoolNameCh[3]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleSchoolNameCh[4])) { Util.printError("封面中文学校名段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleSchoolNameCh[5])) { Util.printError("封面中文学校名段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleSchoolNameCh[0], "Times New Roman")) { Util.printError("封面中文学校名字体错误,应为" + coverstyleSchoolNameCh[0]); } if (!Util.correctsize(list[i], doc, coverstyleSchoolNameCh[2])) { Util.printError("封面中文学校名字号错误,应为" + coverstyleSchoolNameCh[2]); } //封面英文学校名 while (true) { i++; if (i > 100 || Util.getFullText(list[i]).Trim().Length != 0) { break; } } if (!Util.correctJustification(list[i], doc, coverstyleSchoolNameEn[1])) { Util.printError("封面英文学校名未居中"); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleSchoolNameEn[3])) { Util.printError("封面英文学校名行间距错误,应为" + Util.DSmap[coverstyleSchoolNameEn[3]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleSchoolNameEn[4])) { Util.printError("封面英文学校名段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleSchoolNameEn[5])) { Util.printError("封面英文学校名段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleSchoolNameEn[0], "Times New Roman")) { Util.printError("封面英文学校名字体错误,应为" + coverstyleSchoolNameEn[0]); } if (!Util.correctsize(list[i], doc, coverstyleSchoolNameEn[2])) { Util.printError("封面英文学校名字号错误,应为" + coverstyleSchoolNameEn[2]); } } Util.printError("----------------------------------------------"); }
//论文封面检测 public void detectCoverStyle(List <Paragraph> list, WordprocessingDocument doc) { Tools.Util.printError("封面检测"); Util.printError("----------------------------------------------"); if (list.Count <= 0) { if (bool.Parse(coverstyleHeadline[0])) { Util.printError("论文缺少封面部分"); } } else { int i = -1; //封面大标题 while (true) { i++; if (Util.getFullText(list[i]).Trim().Length != 0) { break; } } string CovHeadline = Util.getFullText(list[i]).Replace(" ", ""); if (CovHeadline != "大连理工大学本科毕业设计(论文)") { Util.printError("论文封面大标题有误,应为“大连理工大学本科毕业设计(论文)”"); } if (!(Util.getFullText(list[i]).Trim().Length - 16 == int.Parse(coverstyleHeadline[1]) || Util.getFullText(list[i]).Trim().Length - 10 == int.Parse(coverstyleHeadline[1]) + 4)) { Util.printError("封面大标题中间不应多余包含空格且不应该缺少字符"); } if (!Util.correctJustification(list[i], doc, coverstyleHeadline[2])) { Util.printError("封面大标题对齐方式错误,应为" + coverstyleHeadline[2]); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleHeadline[6])) { Util.printError("封面大标题行间距错误,应为" + Util.DSmap[coverstyleHeadline[3]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleHeadline[7])) { Util.printError("封面大标题段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleHeadline[8])) { Util.printError("封面大标题段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleHeadline[3], "Times New Roman")) { Util.printError("封面大标题字体错误,应为" + coverstyleHeadline[3]); } if (!Util.correctsize(list[i], doc, coverstyleHeadline[4])) { Util.printError("封面大标题字号错误,应为" + coverstyleHeadline[4]); } if (!Util.correctBold(list[i], doc, bool.Parse(coverstyleHeadline[5]))) { if (bool.Parse(coverstyleHeadline[5])) { Util.printError("封面大标题未加粗"); } else { Util.printError("封面大标题不需加粗"); } } //封面大标题中文括号检测 if (Util.getFullText(list[0]).IndexOf("(") == -1 || Util.getFullText(list[0]).IndexOf(")") == -1) { Util.printError("论文大标题的括号有误,应为中文括号"); } //封面中文小标题 while (true) { i++; if (Util.getFullText(list[i]).Trim().Length != 0) { break; } } string SubChText = Util.getFullText(list[i]).Replace(" ", "").Trim(); int SubChWordNum = Util.getFullText(list[i]).Replace(" ", "").Trim().Length; for (int j = 0; j < Util.getFullText(list[i]).Replace(" ", "").Trim().Length; j++) { if ((SubChText[j] >= 48 && SubChText[j] <= 57) || (SubChText[j] >= 65 && SubChText[j] <= 90) || (SubChText[j] >= 97 && SubChText[j] <= 122)) { int k = 0; int m = j; for (; ; m++) { if (!((SubChText[m] >= 48 && SubChText[m] <= 57) || (SubChText[m] >= 65 && SubChText[m] <= 90) || (SubChText[m] >= 97 && SubChText[m] <= 122))) { break; } k++; } SubChWordNum = SubChWordNum - k + 1; j = m; } } if (SubChWordNum > int.Parse(coverstyleSubtitleCh[0])) { Util.printError("封面中文小标题字数超过20个"); } if (!Util.correctJustification(list[i], doc, coverstyleSubtitleCh[1])) { Util.printError("封面中文小标题对齐方式错误,应为" + coverstyleSubtitleCh[1]); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleSubtitleCh[5])) { Util.printError("封面中文小标题行间距错误,应为" + Util.DSmap[coverstyleSubtitleCh[5]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleSubtitleCh[6])) { Util.printError("封面中文小标题段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleSubtitleCh[7])) { Util.printError("封面中文小标题段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleSubtitleCh[2], "Times New Roman")) { Util.printError("封面中文小标题字体错误,应为" + coverstyleSubtitleCh[2]); } if (!Util.correctsize(list[i], doc, coverstyleSubtitleCh[4])) { Util.printError("封面中文小标题字号错误,应为" + coverstyleSubtitleCh[4]); } if (!Util.correctBold(list[i], doc, bool.Parse(coverstyleSubtitleCh[3]))) { if (bool.Parse(coverstyleSubtitleCh[3])) { Util.printError("封面中文小标题未加粗"); } else { Util.printError("封面中文小标题不需加粗"); } } //检测封面中文小标题之间是否有多余转行 while (true) { i++; if (Util.getFullText(list[i]).Trim().Length != 0) { break; } } string CNorEn_SubtitleText = Util.getFullText(list[i]).Replace(" ", ""); if (!((CNorEn_SubtitleText[0] >= 65 && CNorEn_SubtitleText[0] <= 90) || (CNorEn_SubtitleText[0] >= 97 && CNorEn_SubtitleText[0] <= 122))) { Util.printError("封面中文小标题中间不应该有转行"); } //封面英文小标题 string EnSubtitleString; while (true) { EnSubtitleString = Util.getFullText(list[i]).Replace(" ", ""); if ((EnSubtitleString[0] >= 65 && EnSubtitleString[0] <= 90) || (EnSubtitleString[0] >= 97 && EnSubtitleString[0] <= 122)) { break; } i++; } if (!Util.correctJustification(list[i], doc, coverstyleSubtitleEn[0])) { Util.printError("封面英文小标题对齐方式错误,应为" + coverstyleSubtitleEn[0]); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleSubtitleEn[4])) { Util.printError("封面英文小标题行间距错误,应为" + Util.DSmap[coverstyleSubtitleEn[4]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleSubtitleEn[5])) { Util.printError("封面英文小标题段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleSubtitleEn[6])) { Util.printError("封面英文小标题段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, "Times New Roman", coverstyleSubtitleEn[1])) { Util.printError("封面英文小标题字体错误,应为" + coverstyleSubtitleEn[1]); } if (!Util.correctsize(list[i], doc, coverstyleSubtitleEn[3])) { Util.printError("封面英文小标题字号错误,应为" + coverstyleSubtitleEn[3]); } if (!Util.correctBold(list[i], doc, bool.Parse(coverstyleSubtitleEn[2]))) { if (bool.Parse(coverstyleSubtitleEn[2])) { Util.printError("封面英文小标题未加粗"); } else { Util.printError("封面英文小标题不需加粗"); } } //英文小标题字母大小写的检测 string[] CapitalEmptyWord = { "A", "Above", "An", "As", "Behind", "But", "Before", "If", "The", "At", "For", "From", "Of", "Off", "On", "To", "In", "With", "And", "As", "While", "So" }; string[] SmallEmptyWord = { "a", "above", "an", "as", "behind", "but", "before", "if", "the", "at", "for", "from", "of", "off", "on", "to", "in", "with", "and", "as", "while", "so" }; string SubtitleEnText = Util.getFullText(list[i]); int SubtitleEnTextLength = Util.getFullText(list[i]).Trim().Length; if (!(SubtitleEnText[0] >= 65 && SubtitleEnText[0] <= 90)) { Util.printError("论文英文题目句首的单词首字母未大写"); } int LastSpaceInText = SubtitleEnText.LastIndexOf(' '); int NumInText = 0; bool IsHaveEmptyWord = false; for (; NumInText < SubtitleEnTextLength; NumInText++) { if (SubtitleEnText[NumInText] == ' ' && NumInText < LastSpaceInText) { string Word = ""; bool IsWordEmpty = true; bool WordFlag = true; int a = SubtitleEnText.IndexOf(' ', NumInText + 1); Word = SubtitleEnText.Substring(NumInText + 1, a - NumInText - 1); if (a - NumInText - 1 > 0) { IsWordEmpty = false; } else { IsHaveEmptyWord = true; } foreach (string S in CapitalEmptyWord) { if (Word == S) { Util.printError("论论文英文题目非句首虚词首字母不应大写" + " ----" + Word); } } foreach (string C in SmallEmptyWord) { if (Word == C) { WordFlag = false; } } if (WordFlag && !IsWordEmpty) { if (!(Word[0] >= 65 && Word[0] <= 90) && Word.IndexOf("(") == -1) { Util.printError("论文英文标题实词首字母未大写" + " ----" + Word); } } } if (SubtitleEnText[NumInText] == ' ' && NumInText == LastSpaceInText) { bool WordFlag = true; string Word = SubtitleEnText.Substring(NumInText + 1); foreach (string S in CapitalEmptyWord) { if (Word == S) { Util.printError("论论文英文题目非句首虚词首字母不应大写" + " ----" + Word); } } foreach (string C in SmallEmptyWord) { if (Word == C) { WordFlag = false; } } if (WordFlag) { if (Word[0] != '\0') { if (!(Word[0] >= 65 && Word[0] <= 90) && Word.IndexOf("(") == -1) { Util.printError("论文英文标题实词首字母未大写" + " ----" + Word); } } } } } if (IsHaveEmptyWord) { Util.printError("论文英文题目里单词间含有多余的空格"); } //检测封面英文小标题之间是否有多余转行 while (true) { i++; if (Util.getFullText(list[i]).Trim().Length != 0) { break; } } string SubOrStuInformationText = Util.getFullText(list[i]).Replace(" ", ""); if ((SubOrStuInformationText[0] >= 65 && SubOrStuInformationText[0] <= 90) || (SubOrStuInformationText[0] >= 97 && SubOrStuInformationText[0] <= 122)) { Util.printError("封面英文小标题中间不应该有转行"); } //封面学生信息 int NumLost = 0; string StuInformationString; while (true) { StuInformationString = Util.getFullText(list[i]).Replace(" ", ""); if (Util.getFullText(list[i]).Trim().Length != 0 && !((StuInformationString[0] >= 65 && StuInformationString[0] <= 90) || (StuInformationString[0] >= 97 && StuInformationString[0] <= 122))) { break; } i++; } int FirstStuInformation = i; int StuInformationLine = 0; string[] EachStuInformation = new string[] { "学院(系)", "专业", "学生姓名", "学号", "指导教师", "评阅教师", "完成日期" }; for (; i <= FirstStuInformation + 6; i++) { StuInformationLine++; StuInformationString = Util.getFullText(list[i]).Replace(" ", ""); if (Util.getFullText(list[i]).Trim().Length != 0) { if (StuInformationString.IndexOf(EachStuInformation[i - FirstStuInformation]) == -1) { Util.printError("第" + StuInformationLine + "学生信息应为:" + EachStuInformation[i - FirstStuInformation]); } if (!Util.correctJustification(list[i], doc, coverstyleStuInformation[2])) { Util.printError("第" + StuInformationLine + "行学生信息" + "(" + StuInformationString + ")" + "对齐方式错误,应为" + coverstyleStuInformation[2]); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleStuInformation[4])) { Util.printError("第" + StuInformationLine + "行学生信息" + "(" + StuInformationString + ")" + "行间距错误,应为" + Util.DSmap[coverstyleStuInformation[4]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleStuInformation[5])) { Util.printError("第" + StuInformationLine + "行学生信息" + "(" + StuInformationString + ")" + "段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleStuInformation[6])) { Util.printError("第" + StuInformationLine + "行学生信息" + "(" + StuInformationString + ")" + "段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleStuInformation[1], "Times New Roman")) { Util.printError("第" + StuInformationLine + "行学生信息" + "(" + StuInformationString + ")" + "字体错误,应为" + coverstyleStuInformation[1]); } if (!Util.correctsize(list[i], doc, coverstyleStuInformation[3])) { Util.printError("第" + StuInformationLine + "行学生信息" + "(" + StuInformationString + ")" + "字号错误,应为" + coverstyleStuInformation[3]); } } else { NumLost++; } } if (NumLost != 0) { Util.printError("学生信息有" + NumLost + "行缺省"); } //封面中文学校名 while (true) { i++; if (Util.getFullText(list[i]).Trim().Length != 0) { break; } } if (!Util.correctJustification(list[i], doc, coverstyleSchoolNameCh[1])) { Util.printError("封面中文学校名对齐方式错误,应为" + coverstyleSchoolNameCh[1]); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleSchoolNameCh[3])) { Util.printError("封面中文学校名行间距错误,应为" + Util.DSmap[coverstyleSchoolNameCh[3]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleSchoolNameCh[4])) { Util.printError("封面中文学校名段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleSchoolNameCh[5])) { Util.printError("封面中文学校名段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleSchoolNameCh[0], "Times New Roman")) { Util.printError("封面中文学校名字体错误,应为" + coverstyleSchoolNameCh[0]); } if (!Util.correctsize(list[i], doc, coverstyleSchoolNameCh[2])) { Util.printError("封面中文学校名字号错误,应为" + coverstyleSchoolNameCh[2]); } //封面英文学校名 while (true) { i++; if (Util.getFullText(list[i]).Trim().Length != 0) { break; } } if (!Util.correctJustification(list[i], doc, coverstyleSchoolNameEn[1])) { Util.printError("封面英文学校名对齐方式错误,应为" + coverstyleSchoolNameEn[1]); } if (!Util.correctSpacingBetweenLines_line(list[i], doc, coverstyleSchoolNameEn[3])) { Util.printError("封面英文学校名行间距错误,应为" + Util.DSmap[coverstyleSchoolNameEn[3]]); } if (!Util.correctSpacingBetweenLines_Be(list[i], doc, coverstyleSchoolNameEn[4])) { Util.printError("封面英文学校名段前间距错误,应为0行"); } if (!Util.correctSpacingBetweenLines_Af(list[i], doc, coverstyleSchoolNameEn[5])) { Util.printError("封面英文学校名段后间距错误,应为0行"); } if (!Util.correctfonts(list[i], doc, coverstyleSchoolNameEn[0], "Times New Roman")) { Util.printError("封面英文学校名字体错误,应为" + coverstyleSchoolNameEn[0]); } if (!Util.correctsize(list[i], doc, coverstyleSchoolNameEn[2])) { Util.printError("封面英文学校名字号错误,应为" + coverstyleSchoolNameEn[2]); } } Util.printError("----------------------------------------------"); }