Пример #1
0
        /// <summary>
        /// 将说明书文档的内容存入系统
        /// </summary>
        /// <param name="dict"></param>
        public Dictionary <string, List <string> > AddSpecificationToSysResource(string filepath)
        {
            HandleDocument handleDocument            = new HandleDocument();
            Dictionary <string, List <string> > dict = handleDocument.generateSpecificationRegTOC(filepath);

            ////将目录以一定格式存入系统文件
            string filename = filepath.Substring(filepath.LastIndexOf("\\") + 1, filepath.LastIndexOf(".") - filepath.LastIndexOf("\\") - 1);

            string s = "";

            foreach (KeyValuePair <string, List <string> > kvp in dict)
            {
                s += kvp.Key + "-";
                foreach (string ss in kvp.Value)
                {
                    s += ss + ",";
                }
                s += ";";
            }
            WritePrivateProfileString("specification-" + filename, filename, s, filePath.SPEC);

            StringBuilder temp = new StringBuilder(2500);
            int           re   = GetPrivateProfileString("section-specification", "history", "", temp, 2500, filePath.TOCFILEPATH);
            string        t    = temp.ToString();

            char[]   chSplit = ",".ToCharArray();
            string[] key     = t.Split(chSplit);

            List <string> keyList = new List <string>(key);

            if (!keyList.Contains(filename))
            {
                keyList.Add(filename);
            }
            keyList.RemoveAll(spaceContents);

            string value = null;

            foreach (string ss in keyList)
            {
                if (keyList.Last() != ss)
                {
                    value += ss + ",";
                }
                else
                {
                    value += ss + ",";
                }
            }

            WritePrivateProfileString("section-specification", "history", value, filePath.TOCFILEPATH);
            return(dict);
        }
Пример #2
0
        public Dictionary <string, List <string> > generateSpecificationRegTOC(string filepath)
        {
            ApplicationClass app            = new ApplicationClass();
            Document         doc            = new Document();
            HandleDocument   handleDocument = new HandleDocument();

            doc = handleDocument.openDocument(filepath, app);

            Dictionary <string, List <string> > dict = new Dictionary <string, List <string> >();
            int    c       = doc.Paragraphs.Count;
            bool   isStart = false;
            string chapter = "";
            Regex  regNum  = new Regex("^[0-9]");
            Regex  reg     = new Regex(@"[\u4e00-\u9fa5]");//


            for (int i = 1; i <= c; i++)
            {
                string s = doc.Paragraphs[i].Range.Text;

                //int ccc = Convert.ToInt32(s[s.Length - 1]);
                //MessageBox.Show(ccc.ToString());

                if (s.IndexOf("第") == 0 && (s.IndexOf("章") == 2 || s.IndexOf("章") == 3))
                {
                    isStart = true;
                }
                if (isStart)
                {
                    if (s.IndexOf("第") == 0 && (s.IndexOf("章") == 2 || s.IndexOf("章") == 3))
                    {
                        s       = s.Replace("\r", "");
                        chapter = s;
                        dict.Add(s, new List <string>());
                    }
                    else if (regNum.IsMatch(s) && reg.IsMatch(s))
                    {
                        s = s.Replace("\r", "");
                        dict[chapter].Add(s);
                    }
                }
            }


            Object saveChanges = false;
            object unknow      = Type.Missing;

            doc.Close(ref saveChanges, ref unknow, ref unknow);
            app.Quit(ref saveChanges, ref unknow, ref unknow);

            return(dict);
        }
Пример #3
0
        private void anyOneDocHighLigth(string multiFilePath, ApplicationClass testWord, string keyWord, RichTextBox rtbHightLight,
                                        Label count, RichTextBox StatisticsInfor, HandleDocument handleDocument)
        {
            WaitingForm wf = new WaitingForm();

            HandleWaitingForm.startWaitingForm(wf);

            Document doc = handleDocument.openDocument(multiFilePath, testWord);

            highLightKeyWords(keyWord, testWord, doc, rtbHightLight, count, StatisticsInfor);
            closeDoc(doc);

            HandleWaitingForm.closeWaitingForm(wf);
        }
Пример #4
0
        /*
         * get regulation table of content in document or db by name
         */
        public Dictionary <string, List <TermContainer> > getTOCContentsByName(string name)
        {
            string path = System.Environment.CurrentDirectory;

            name = path + "\\resources\\" + name + ".doc";
            ApplicationClass regWord        = new ApplicationClass();
            Document         regDoc         = new Document();
            HandleDocument   handleDocument = new HandleDocument();

            regDoc = handleDocument.openDocument(name, regWord);

            Table table = regDoc.Tables[1];
            int   rows  = table.Rows.Count;
            Dictionary <string, List <TermContainer> > dic = new Dictionary <string, List <TermContainer> >();

            string key     = "";
            string section = "";

            for (int i = 1; i <= rows; i++)
            {
                string text = getTableCellText(table, i, 1);
                if (isLevel1Cell(text))
                {
                    section = "";
                    key     = text;
                    dic.Add(text, new List <TermContainer>());
                }
                else
                {
                    if (isLevelSection(text))
                    {
                        section = text;
                    }
                    else
                    {
                        TermContainer term = getTableCellContainer(section, table, i);
                        dic[key].Add(term);
                    }
                }
            }
            quit(regWord, regDoc);
            return(dic);
        }
Пример #5
0
        /// <summary>
        /// put new regulation document into system resource and extract toc
        /// </summary>
        /// <param name="filepath"></param>
        /// <returns></returns>
        public Dictionary <string, List <TermContainer> > AddRegToSysResource(string filepath)
        {
            string fname = filepath.Substring(filepath.LastIndexOf("\\") + 1, filepath.LastIndexOf(".") - filepath.LastIndexOf("\\") - 1);

            putNewRegTocInINIFile(fname);

            ApplicationClass regWord        = new ApplicationClass();
            Document         regDoc         = new Document();
            HandleDocument   handleDocument = new HandleDocument();

            regDoc = handleDocument.openDocument(filepath, regWord);

            Table table = regDoc.Tables[1];
            int   rows  = table.Rows.Count;
            Dictionary <string, List <TermContainer> > dic = new Dictionary <string, List <TermContainer> >();

            string key     = "";
            string section = "";

            for (int i = 1; i <= rows; i++)
            {
                string text = getTableCellText(table, i, 1);
                if (isLevel1Cell(text))
                {
                    section = "";
                    key     = text;
                    dic.Add(text, new List <TermContainer>());
                }
                else
                {
                    if (isLevelSection(text))
                    {
                        section = text;
                    }
                    else
                    {
                        TermContainer term = getTableCellContainer(section, table, i);
                        dic[key].Add(term);
                    }
                }
            }

            string path       = System.Environment.CurrentDirectory;
            string name       = path + "\\resources\\" + regDoc.Name;
            object saveAsName = path + "\\resources\\" + regDoc.Name;

            object unknow = Type.Missing;

            if (!File.Exists(name))
            {
                regDoc.SaveAs(ref saveAsName, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow);
            }
            else
            {
                //shifou ti huan
                File.Delete(name);
                regDoc.SaveAs(ref saveAsName, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow);
            }
            quit(regWord, regDoc);
            return(dic);
        }
Пример #6
0
        private void btnFindTable_Click(object sender, EventArgs e)
        {
            tabControl2.SelectTab("tabCalculateTable");

            string regFileName = cbxRegDoc.Text;
            string tablename   = cbxTableList.Text;

            if (testFileName == null || testFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个目标文档");
            }
            else if (regFileName == null || regFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个规程文档");
            }
            else
            {
                if ((!regFileName.Equals(preRegFileName) || !testFileName.Equals(preTestFileName) ||
                     cbxTableListChanged == true))
                {
                    dataView.Rows.Clear();
                    rbTableTest.Clear();

                    WaitingForm wf = new WaitingForm();
                    HandleWaitingForm.startWaitingForm(wf);

                    string path = System.Environment.CurrentDirectory;
                    string name = regFileName;
                    name = path + "\\resources\\" + name + ".doc";

                    Document       regDoc         = new Document();
                    HandleDocument handleDocument = new HandleDocument();


                    if (!testDocIsOpen)
                    {
                        testDocIsOpen = true;
                        testDoc       = handleDocument.openDocument(testFileName, testWord);
                    }

                    regDoc = handleDocument.openDocument(name, testWord);
                    showItemInfo.Clear();
                    flagList.Clear();//清空标记合并单元格的标志
                    if (tablename != "")
                    {
                        calTables(1, regDoc, wf, tablename);
                    }
                    else
                    {
                        calTables(tableName.Length, regDoc, wf, "");
                    }
                    rbTableTest.Text = "请选择关键字";
                    KeyWord keyWord = new KeyWord();
                    //keyWord.highLightRichString(rbTableTest, testWord, testDoc, keyItemList);
                    rtbStandard.Text = keyWord.getStandardList();
                    generatekeyItemCombox();

                    Object saveChanges = false;
                    object unknow      = Type.Missing;

                    regDoc.Close(ref saveChanges, ref unknow, ref unknow);

                    HandleWaitingForm.closeWaitingForm(wf);

                    plTOC.Hide();
                    plKeyWord.Hide();
                    plMultiInfo.Hide();

                    plTableTest.Show();
                    showTableTreeView();
                    hideTOCTreeView();

                    cbxTableListChanged = false;
                    preRegFileName      = regFileName;
                    preTestFileName     = testFileName;

                    isMultiple = false;
                    tabControl2.Show();
                    tabControlMulti.Hide();
                }
            }
        }
Пример #7
0
        private void btnTestTable_Click(object sender, EventArgs e)
        {
            tabControl2.SelectTab("tabPageTest");

            string regFileName = cbxRegDoc.Text;

            if (testFileName == null || testFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个目标文档");
            }
            else if (regFileName == null || regFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个规程文档");
            }
            else if (!isTextMode())
            {
                MessageBox.Show("非文本文档检测模式不支持表格匹配,请在目录检测中选择文本模式");
            }
            else
            {
                HandleTable handleTable = new HandleTable(testWord);

                string path = System.Environment.CurrentDirectory;
                string name = regFileName;
                name = path + "\\resources\\" + name + ".doc";

                Document       regDoc         = new Document();
                HandleDocument handleDocument = new HandleDocument();

                WaitingForm wf = new WaitingForm();
                HandleWaitingForm.startWaitingForm(wf);

                if (!testDocIsOpen)
                {
                    testDocIsOpen = true;
                    testDoc       = handleDocument.openDocument(testFileName, testWord);
                }

                regDoc = handleDocument.openDocument(name, testWord);

                handleTable.contrastTablesOfDocs(regDoc, testDoc, showItemInfo, tvRegTable
                                                 , tvTestTable, null, null, null);

                Object saveChanges = false;
                object unknow      = Type.Missing;

                regDoc.Close(ref saveChanges, ref unknow, ref unknow);

                HandleWaitingForm.closeWaitingForm(wf);

                plTOC.Hide();
                plKeyWord.Hide();
                plMultiInfo.Hide();

                plTableTest.Show();
                showTableTreeView();
                hideTOCTreeView();

                isMultiple = false;
                tabCalculateTable.Show();
                tabControlMulti.Hide();
            }
        }
Пример #8
0
        private void btnAddNewDoc_Click(object sender, EventArgs e)
        {
            if (rbText.Checked || rbSpecification.Checked)
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Filter = "Word文件|*.doc";
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    regFileName = openFileDialog.FileName;
                    string filename = regFileName.Substring(regFileName.LastIndexOf("\\") + 1, regFileName.LastIndexOf(".") - regFileName.LastIndexOf("\\") - 1);
                    if (rbText.Checked)
                    {
                        if (!textResults.Contains(filename))
                        {
                            waitForm = new WaitingForm();
                            HandleWaitingForm.startWaitingForm(waitForm);

                            regTOCContents = toc.AddRegToSysResource(regFileName);
                            addNewRegDoc   = true;
                            textResults.Add(filename);
                            txbDocName.Text = filename;
                            tvRegDoc.Nodes.Add(filename);
                            tvRegDoc.Update();

                            HandleWaitingForm.closeWaitingForm(waitForm);
                        }
                        else
                        {
                            if (MessageBox.Show("已存在!是否替换", "提示框", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                waitForm = new WaitingForm();
                                HandleWaitingForm.startWaitingForm(waitForm);

                                regTOCContents  = toc.AddRegToSysResource(regFileName);
                                addNewRegDoc    = true;
                                txbDocName.Text = filename;

                                HandleWaitingForm.closeWaitingForm(waitForm);
                            }
                            else
                            {
                                //
                            }
                        }
                    }
                    else
                    {
                        if (!specificationResults.Contains(filename))
                        {
                            waitForm = new WaitingForm();
                            HandleWaitingForm.startWaitingForm(waitForm);

                            HandleDocument handleDocument = new HandleDocument();
                            ////获得说明书规程文档目录
                            ////将说明书目录存入系统
                            specificationTOCContents = toc.AddSpecificationToSysResource(regFileName);

                            addNewRegDoc = true;
                            specificationResults.Add(filename);
                            txbDocName.Text = filename;
                            tvSpecificationDoc.Nodes.Add(filename);
                            tvSpecificationDoc.Update();

                            HandleWaitingForm.closeWaitingForm(waitForm);
                        }
                        else
                        {
                            if (MessageBox.Show("已存在!是否替换", "提示框", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                waitForm = new WaitingForm();
                                HandleWaitingForm.startWaitingForm(waitForm);

                                HandleDocument handleDocument = new HandleDocument();
                                ////获得说明书规程文档目录
                                ////将说明书目录存入系统
                                specificationTOCContents = toc.AddSpecificationToSysResource(regFileName);
                                addNewRegDoc             = true;
                                txbDocName.Text          = filename;

                                HandleWaitingForm.closeWaitingForm(waitForm);
                            }
                            else
                            {
                                //
                            }
                        }
                    }
                    toc.update(cbx);
                }
            }
            else
            {
                MessageBox.Show("请选择一种规程类型");
            }
        }
Пример #9
0
        public Dictionary<string, List<string>> generateSpecificationRegTOC(string filepath)
        {
            ApplicationClass app = new ApplicationClass();
            Document doc = new Document();
            HandleDocument handleDocument = new HandleDocument();
            doc = handleDocument.openDocument(filepath,app);

            Dictionary<string,List<string>> dict  = new Dictionary<string,List<string>>();
            int c = doc.Paragraphs.Count;
            bool isStart = false;
            string chapter = "";
            Regex regNum = new Regex("^[0-9]");
            Regex reg = new Regex(@"[\u4e00-\u9fa5]");//

            
            for (int i = 1; i <= c; i++)
            {
                string s = doc.Paragraphs[i].Range.Text;
      
                //int ccc = Convert.ToInt32(s[s.Length - 1]);
                //MessageBox.Show(ccc.ToString());

                if(s.IndexOf("第") == 0 && (s.IndexOf("章") ==  2 || s.IndexOf("章") == 3))
                {
                    isStart = true;
                }
                if (isStart)
                {
                    if (s.IndexOf("第") == 0 && (s.IndexOf("章") == 2 || s.IndexOf("章") == 3))
                    {
                        s = s.Replace("\r", "");
                        chapter = s;
                        dict.Add(s,new List<string>());
                    }
                    else if (regNum.IsMatch(s) && reg.IsMatch(s))
                    {
                        s = s.Replace("\r", "");
                        dict[chapter].Add(s);
                    }
                }
            }
            

            Object saveChanges = false;
            object unknow = Type.Missing;

            doc.Close(ref saveChanges, ref unknow, ref unknow);
            app.Quit(ref saveChanges, ref unknow, ref unknow);

            return dict;
        }
Пример #10
0
        /*
         * get regulation table of content in document or db by name
         */
        public Dictionary<string, List<TermContainer>> getTOCContentsByName(string name)
        {
            string path = System.Environment.CurrentDirectory;          
            name = path +  "\\resources\\"+ name+".doc";   
            ApplicationClass regWord = new ApplicationClass();
            Document regDoc = new Document();
            HandleDocument handleDocument = new HandleDocument();
    
            regDoc = handleDocument.openDocument(name, regWord);

            Table table = regDoc.Tables[1];
            int rows = table.Rows.Count;
            Dictionary<string, List<TermContainer>> dic = new Dictionary<string, List<TermContainer>>();

            string key = "";
            string section = "";
            for (int i = 1; i <= rows; i++)
            {
                string text = getTableCellText(table, i, 1);
                if (isLevel1Cell(text))
                {
                    section = "";
                    key = text;
                    dic.Add(text, new List<TermContainer>());
                }
                else
                {
                    if (isLevelSection(text))
                    {
                        section = text;
                    }
                    else
                    {
                        TermContainer term = getTableCellContainer(section, table, i);
                        dic[key].Add(term);
                    }
                }
            }
            quit(regWord,regDoc);
            return dic;
        }
Пример #11
0
        /// <summary>
        /// 将说明书文档的内容存入系统
        /// </summary>
        /// <param name="dict"></param>
        public Dictionary<string, List<string>> AddSpecificationToSysResource(string filepath)
        {
            HandleDocument handleDocument = new HandleDocument();
            Dictionary<string, List<string>> dict = handleDocument.generateSpecificationRegTOC(filepath);

            ////将目录以一定格式存入系统文件           
            string filename = filepath.Substring(filepath.LastIndexOf("\\") + 1, filepath.LastIndexOf(".") - filepath.LastIndexOf("\\") - 1);

            string s = "";
            foreach (KeyValuePair<string, List<string>> kvp in dict)
            {
                s += kvp.Key + "-";
                foreach (string ss in kvp.Value)
                {
                    s += ss + ",";
                }
                s += ";";
            }
            WritePrivateProfileString("specification-"+filename, filename, s, filePath.SPEC);
            
            StringBuilder temp = new StringBuilder(2500);
            int re = GetPrivateProfileString("section-specification", "history", "", temp, 2500, filePath.TOCFILEPATH);
            string t = temp.ToString();

            char[] chSplit = ",".ToCharArray();
            string[] key = t.Split(chSplit);

            List<string> keyList = new List<string>(key);
            if(!keyList.Contains(filename))
                keyList.Add(filename);
            keyList.RemoveAll(spaceContents);

            string value = null;
            foreach (string ss in keyList)
            {
                if (keyList.Last() != ss)
                    value += ss + ",";
                else
                    value += ss + ",";
            }

            WritePrivateProfileString("section-specification", "history", value, filePath.TOCFILEPATH);
            return dict;    
        }
Пример #12
0
        /// <summary>
        /// put new regulation document into system resource and extract toc 
        /// </summary>
        /// <param name="filepath"></param>
        /// <returns></returns>
        public Dictionary<string, List<TermContainer>> AddRegToSysResource(string filepath)
        {
            string fname = filepath.Substring(filepath.LastIndexOf("\\") + 1, filepath.LastIndexOf(".") - filepath.LastIndexOf("\\") - 1);
            putNewRegTocInINIFile(fname);

            ApplicationClass regWord = new ApplicationClass();
            Document regDoc = new Document();
            HandleDocument handleDocument = new HandleDocument();
  
            regDoc = handleDocument.openDocument(filepath, regWord);
            
            Table table = regDoc.Tables[1];
            int rows = table.Rows.Count;
            Dictionary<string, List<TermContainer>> dic = new Dictionary<string, List<TermContainer>>();
            
            string key = "";
            string section = "";
            for(int i = 1;i<= rows;i++)
            {                 
                string text = getTableCellText(table, i, 1);               
                if (isLevel1Cell(text))
                {
                    section = "";
                    key = text; 
                    dic.Add(text, new List<TermContainer>());             
                }
                else 
                {
                    if (isLevelSection(text))
                    {                  
                        section = text;
                    }
                    else
                    {
                        TermContainer term = getTableCellContainer(section,table, i);
                        dic[key].Add(term);
                    }
                }
            }

            string path = System.Environment.CurrentDirectory;
            string name = path + "\\resources\\"+regDoc.Name;
            object saveAsName = path + "\\resources\\" + regDoc.Name;
            
            object unknow = Type.Missing;

            if (!File.Exists(name))
            {
                regDoc.SaveAs(ref saveAsName, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow);
            }
            else
            {
                //shifou ti huan
                File.Delete(name);
                regDoc.SaveAs(ref saveAsName, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow, ref unknow);
            }
            quit(regWord, regDoc);
            return dic;
        }
Пример #13
0
        private void btnAddNewDoc_Click(object sender, EventArgs e)
        {
            if (rbText.Checked || rbSpecification.Checked)
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Filter = "Word文件|*.doc";
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    regFileName = openFileDialog.FileName;
                    string filename = regFileName.Substring(regFileName.LastIndexOf("\\") + 1, regFileName.LastIndexOf(".") - regFileName.LastIndexOf("\\") - 1);
                    if (rbText.Checked)
                    {
                        if (!textResults.Contains(filename))
                        {
                            waitForm = new WaitingForm();
                            HandleWaitingForm.startWaitingForm(waitForm);

                            regTOCContents = toc.AddRegToSysResource(regFileName);
                            addNewRegDoc = true;
                            textResults.Add(filename);
                            txbDocName.Text = filename;
                            tvRegDoc.Nodes.Add(filename);
                            tvRegDoc.Update();

                            HandleWaitingForm.closeWaitingForm(waitForm);
                        }
                        else
                        {
                            if (MessageBox.Show("已存在!是否替换", "提示框", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {

                                waitForm = new WaitingForm();
                                HandleWaitingForm.startWaitingForm(waitForm);

                                regTOCContents = toc.AddRegToSysResource(regFileName);
                                addNewRegDoc = true;
                                txbDocName.Text = filename;

                                HandleWaitingForm.closeWaitingForm(waitForm);
                            }
                            else
                            {
                                //
                            }
                        }
                    }
                    else
                    {
                        if (!specificationResults.Contains(filename))
                        {
                            waitForm = new WaitingForm();
                            HandleWaitingForm.startWaitingForm(waitForm);

                            HandleDocument handleDocument = new HandleDocument();
                            ////获得说明书规程文档目录
                            ////将说明书目录存入系统
                            specificationTOCContents = toc.AddSpecificationToSysResource(regFileName);
                            
                            addNewRegDoc = true;
                            specificationResults.Add(filename);
                            txbDocName.Text = filename;
                            tvSpecificationDoc.Nodes.Add(filename);
                            tvSpecificationDoc.Update();
                            
                            HandleWaitingForm.closeWaitingForm(waitForm);
                        }
                        else
                        {
                            if(MessageBox.Show("已存在!是否替换", "提示框", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                waitForm = new WaitingForm();
                                HandleWaitingForm.startWaitingForm(waitForm);

                                HandleDocument handleDocument = new HandleDocument();
                                ////获得说明书规程文档目录
                                ////将说明书目录存入系统
                                specificationTOCContents = toc.AddSpecificationToSysResource(regFileName);
                                addNewRegDoc = true;
                                txbDocName.Text = filename;

                                HandleWaitingForm.closeWaitingForm(waitForm);
                            } 
                            else
                            {
                                //
                            }
                        }
                        
                    }
                    toc.update(cbx);
                }               
            }
            else
            {
                MessageBox.Show("请选择一种规程类型");
            }
        }
Пример #14
0
        private void anyOneDocHighLigth(string multiFilePath, ApplicationClass testWord, string keyWord, RichTextBox rtbHightLight,
            Label count, RichTextBox StatisticsInfor, HandleDocument handleDocument)
        {
            WaitingForm wf = new WaitingForm();
            HandleWaitingForm.startWaitingForm(wf);

            Document doc = handleDocument.openDocument(multiFilePath, testWord);
            highLightKeyWords(keyWord, testWord, doc, rtbHightLight, count, StatisticsInfor);
            closeDoc(doc);

            HandleWaitingForm.closeWaitingForm(wf);
        }
Пример #15
0
 public void multiHightLigthKeyWord(string preMultiTestFilePath, string preMultiRegFilePath, string preMultiSpecFilePath, string multiTestFilePath, string multiRegFilePath, string multiSpecFilePath,
     string keyWord, ApplicationClass testWord, RichTextBox rtbTest, RichTextBox rtbReg, RichTextBox rtbSpecification, Label test, Label reg,
      Label spec, RichTextBox testStatisticsInfor, RichTextBox regStatisticsInfor, RichTextBox specStatisticsInfor, HandleDocument handleDocument, Boolean isKeyChanged)
 {
     if (checkFilePathInput(multiTestFilePath, multiRegFilePath, multiSpecFilePath) == true)
     {
         if (multiTestFilePath != "" && (!multiTestFilePath.Equals(preMultiTestFilePath) || isKeyChanged))
         {
             anyOneDocHighLigth(multiTestFilePath, testWord, keyWord, rtbTest, test, testStatisticsInfor, handleDocument);
         }
         if (multiRegFilePath != "" && (!multiRegFilePath.Equals(preMultiRegFilePath) || isKeyChanged))
         {
             anyOneDocHighLigth(multiRegFilePath, testWord, keyWord, rtbReg, reg, regStatisticsInfor, handleDocument);
         }
         if (multiSpecFilePath != "" && (!multiSpecFilePath.Equals(preMultiSpecFilePath) || isKeyChanged))
         {
             anyOneDocHighLigth(multiSpecFilePath, testWord, keyWord, rtbSpecification, spec, specStatisticsInfor, handleDocument);
         }
     }
 }
Пример #16
0
        private void btnTestTable_Click(object sender, EventArgs e)
        {
            tabControl2.SelectTab("tabPageTest");

            string regFileName = cbxRegDoc.Text;
            if (testFileName == null || testFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个目标文档");
            }
            else if (regFileName == null || regFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个规程文档");
            }
            else if (!isTextMode())
            {
                MessageBox.Show("非文本文档检测模式不支持表格匹配,请在目录检测中选择文本模式");
            }
            else
            {
                HandleTable handleTable = new HandleTable(testWord);

                string path = System.Environment.CurrentDirectory;
                string name = regFileName;
                name = path + "\\resources\\" + name + ".doc";

                Document regDoc = new Document();
                HandleDocument handleDocument = new HandleDocument();

                WaitingForm wf = new WaitingForm();
                HandleWaitingForm.startWaitingForm(wf);

                if (!testDocIsOpen)
                {
                    testDocIsOpen = true;
                    testDoc = handleDocument.openDocument(testFileName, testWord);
                }

                regDoc = handleDocument.openDocument(name, testWord);

                handleTable.contrastTablesOfDocs(regDoc, testDoc, showItemInfo, tvRegTable
                    , tvTestTable, null, null, null);

                Object saveChanges = false;
                object unknow = Type.Missing;

                regDoc.Close(ref saveChanges, ref unknow, ref unknow);

                HandleWaitingForm.closeWaitingForm(wf);

                plTOC.Hide();
                plKeyWord.Hide();
                plMultiInfo.Hide();

                plTableTest.Show();
                showTableTreeView();
                hideTOCTreeView();

                isMultiple = false;
                tabCalculateTable.Show();
                tabControlMulti.Hide();
            }
        }
Пример #17
0
        private void btnFindTable_Click(object sender, EventArgs e)
        {
            tabControl2.SelectTab("tabCalculateTable");

            string regFileName = cbxRegDoc.Text;
            string tablename = cbxTableList.Text;

            if (testFileName == null || testFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个目标文档");
            }
            else if (regFileName == null || regFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个规程文档");
            }
            else
            {
                if ((!regFileName.Equals(preRegFileName) || !testFileName.Equals(preTestFileName)
                    || cbxTableListChanged == true))
                {
                    dataView.Rows.Clear();
                    rbTableTest.Clear();

                    WaitingForm wf = new WaitingForm();
                    HandleWaitingForm.startWaitingForm(wf);

                    string path = System.Environment.CurrentDirectory;
                    string name = regFileName;
                    name = path + "\\resources\\" + name + ".doc";

                    Document regDoc = new Document();
                    HandleDocument handleDocument = new HandleDocument();

                    
                    if (!testDocIsOpen)
                    {
                        testDocIsOpen = true;
                        testDoc = handleDocument.openDocument(testFileName, testWord);
                    }

                    regDoc = handleDocument.openDocument(name, testWord);
                    showItemInfo.Clear();
                    flagList.Clear();//清空标记合并单元格的标志
                    if (tablename != "")
                    {
                        calTables(1, regDoc, wf, tablename);
                    }
                    else
                    {
                        calTables(tableName.Length, regDoc, wf, "");
                    }
                    rbTableTest.Text = "请选择关键字";
                    KeyWord keyWord = new KeyWord();
                    //keyWord.highLightRichString(rbTableTest, testWord, testDoc, keyItemList);
                    rtbStandard.Text = keyWord.getStandardList();
                    generatekeyItemCombox();
                    
                    Object saveChanges = false;
                    object unknow = Type.Missing;

                    regDoc.Close(ref saveChanges, ref unknow, ref unknow);

                    HandleWaitingForm.closeWaitingForm(wf);

                    plTOC.Hide();
                    plKeyWord.Hide();
                    plMultiInfo.Hide();

                    plTableTest.Show();
                    showTableTreeView();
                    hideTOCTreeView();

                    cbxTableListChanged = false;
                    preRegFileName = regFileName;
                    preTestFileName = testFileName;

                    isMultiple = false;
                    tabControl2.Show();
                    tabControlMulti.Hide();
                }
            }

        }
Пример #18
0
 public void multiHightLigthKeyWord(string preMultiTestFilePath, string preMultiRegFilePath, string preMultiSpecFilePath, string multiTestFilePath, string multiRegFilePath, string multiSpecFilePath,
                                    string keyWord, ApplicationClass testWord, RichTextBox rtbTest, RichTextBox rtbReg, RichTextBox rtbSpecification, Label test, Label reg,
                                    Label spec, RichTextBox testStatisticsInfor, RichTextBox regStatisticsInfor, RichTextBox specStatisticsInfor, HandleDocument handleDocument, Boolean isKeyChanged)
 {
     if (checkFilePathInput(multiTestFilePath, multiRegFilePath, multiSpecFilePath) == true)
     {
         if (multiTestFilePath != "" && (!multiTestFilePath.Equals(preMultiTestFilePath) || isKeyChanged))
         {
             anyOneDocHighLigth(multiTestFilePath, testWord, keyWord, rtbTest, test, testStatisticsInfor, handleDocument);
         }
         if (multiRegFilePath != "" && (!multiRegFilePath.Equals(preMultiRegFilePath) || isKeyChanged))
         {
             anyOneDocHighLigth(multiRegFilePath, testWord, keyWord, rtbReg, reg, regStatisticsInfor, handleDocument);
         }
         if (multiSpecFilePath != "" && (!multiSpecFilePath.Equals(preMultiSpecFilePath) || isKeyChanged))
         {
             anyOneDocHighLigth(multiSpecFilePath, testWord, keyWord, rtbSpecification, spec, specStatisticsInfor, handleDocument);
         }
     }
 }