/// <summary> /// 一键生成汇总表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { //得到报告筛选规则 RuleConfigHelper ruleConfigHelper = new RuleConfigHelper(); RuleConfigHelper.ReadConfig(); //wordlist用于存储评估报告文档文件信息集合 List <FileInfo> wordlist = new List <FileInfo>(); //获取所有类型的文件 List <FileInfo> fileNames = ToolSet.TogetFile(this.textBox1.Text, 2); this.textBox2.AppendText("目录包含以下Word评估报告:\r\n"); foreach (FileInfo fileName in fileNames) { //过滤非评估报告类的文件 if (fileName.Extension.Contains("doc") && (fileName.Name.ToUpper().Contains(RuleConfigHelper.FileName1) || fileName.Name.ToUpper().Contains(RuleConfigHelper.FileName2))) { this.textBox2.AppendText(" -- " + fileName.Name + "\r\n"); wordlist.Add(fileName); } } this.textBox2.AppendText($"共计{wordlist.Count()}个\r\n"); //调用汇总方法 string workinfo = ToolSet.StartSummary(wordlist); this.textBox2.AppendText(workinfo); //this.textBox2.AppendText(ToolSet.information); }