Пример #1
0
        private bool answerspot(ref TreeNode treenode, ref int endfor)
        {
            MartianSpot martianSpot = new MartianSpot();
            List<SubjectInfo> listminisubject = null;
            Subject subject = (Subject)treenode.Tag;
            try
            {
                listminisubject = martianSpot.subjectSpot(mainContent1.WordBrowers.document, ref this.progressBarSpot, MatchArray.answerSpot, subject.rangestart, subject.rangeend);
                if (listminisubject == null || listminisubject.Count == 0)
                    return false;
                for (int i = 0; i < listminisubject.Count; i++)//答案只有一个所以最后的答案为最终答案
                {
                    SubjectInfo subjectInfoStart = listminisubject[i];
                    int start = subjectInfoStart.paragraphsStart;
                    endfor = start;
                    SubjectInfo subjectInfoEnd;
                    int end;
                    if (i == listminisubject.Count - 1)
                    {
                        //subjectInfoEnd = listminisubject[i];
                        //object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
                        //最后一题将范围移动至文档结束
                        end = subject.rangeend;
                    }
                    else
                    {
                        subjectInfoEnd = listminisubject[i + 1];
                        end = subjectInfoEnd.paragraphsStart;
                    }
                    //设定选择范围
                    mainContent1.WordBrowers.document.Application.Selection.SetRange(start + answerprelength, end);//从答案:后面开始录入
                    //更新目录栏
                    mainContent1.WordBrowers.document.Application.Selection.Range.Copy();
                    String html = ClipboardHelper.getClipboardHtml();
                    HtmlUtil.HtmlPictureMove(ref html);
                    String cliptext = ClipboardHelper.getClipboardText();
                    this.webBrowser.DocumentText = html;

                    AnswerContent staa = new AnswerContent();
                    //staa.subjectbinaryanswer = ClipboardHelper.getClipboardEmbed();
                    staa.subjecthtmlanswer = html;
                    staa.subjecttextanswer = cliptext;
                    mainContent1.WordBrowers.document.Application.Selection.SetRange(start, start + 4);
                    int typeint = 1;
                    try
                    {
                        string str = mainContent1.WordBrowers.document.Application.Selection.Text;
                        typeint = Int16.Parse(str.Substring(2,1));
                    }
                    catch (Exception ex)
                    {
                        typeint = 1;
                    }
                    switch (typeint)
                    {
                        case SubjectTypeDefine.singleselecti:
                            staa.selectType = SubjectTypeDefine.singleselect;
                            subject.题目类型 =Subject.SubjecttypeEnum.单选题;
                            break;
                        case SubjectTypeDefine.spacei:
                            staa.selectType = SubjectTypeDefine.space;
                            subject.题目类型 = Subject.SubjecttypeEnum.填空题;
                            break;
                        case SubjectTypeDefine.questioni:
                            staa.selectType = SubjectTypeDefine.question;
                            subject.题目类型 = Subject.SubjecttypeEnum.简答题;
                            break;
                        case SubjectTypeDefine.multiselecti:
                            staa.selectType = SubjectTypeDefine.multiselect;
                            subject.题目类型 = Subject.SubjecttypeEnum.多选题;
                            break;
                        case SubjectTypeDefine.judgei:
                            staa.selectType = SubjectTypeDefine.judge;
                            subject.题目类型 = Subject.SubjecttypeEnum.判断题;
                            break;
                    }

                    subject.answer = staa;
                }
            }
            catch (NullReferenceException ex)
            {
                // MessageBox.Show("请先在程序中打开word文件。");
            }
            return true;
        }
Пример #2
0
        /// <summary>
        /// 
        /// 题目内容建立
        /// </summary>
        /// <param name="treenode">建立所在节点下</param>
        /// <param name="subjectstructure">题目对应匹配结构</param>
        /// <returns> 返回是否有子节点</returns>
        /// 
        private bool SubjectBuild(TreeNode treenode, SubjectStructure subjectstructure,ref int endfor)
        {
            MartianSpot martianSpot = new MartianSpot();
            List<SubjectInfo> listminisubject = null;
            Subject subject = (Subject)treenode.Tag;
            try
            {

                listminisubject = martianSpot.subjectSpot(mainContent1.WordBrowers.document, ref this.progressBarSpot, subjectstructure.subjectPre, subject.rangestart, subject.rangeend);
                if (listminisubject.Count == 0)
                    return false;

                for (int i = 0; i < listminisubject.Count; i++)
                {
                    SubjectInfo subjectInfoStart = listminisubject[i];
                    int start = subjectInfoStart.paragraphsStart;
                    if (i == 0)//去第一个子题的头位置
                    {
                        endfor = start;
                    }
                    SubjectInfo subjectInfoEnd;
                    int end;
                    if (i == listminisubject.Count - 1)
                    {
                        //subjectInfoEnd = listminisubject[i];
                        //object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
                        //最后一题将范围移动至文档结束
                        end = subject.rangeend;
                    }
                    else
                    {
                        subjectInfoEnd = listminisubject[i + 1];
                        end = subjectInfoEnd.paragraphsStart;
                    }
                    //设定选择范围
                    mainContent1.WordBrowers.document.Application.Selection.SetRange(start, end);
                    //更新目录栏
                    SubjectContentBuild(true, treenode, subjectstructure);
                }
                return true;
            }
            catch (NullReferenceException ex)
            {
                return false;
                // MessageBox.Show("请先在程序中打开word文件。");
            }
        }
Пример #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="isSpotWord">区分是否是点击拆分按钮触发的</param>
        private void initTreeRootNode(bool isSpotWord)
        {
            this.treeViewSubject.SelNodes = null;
            this.treeViewSubject.CheckedNodes = null;
            this.treeViewSubject.Nodes.Clear();
            MartianSpot martianSpot = new MartianSpot();
            List<SubjectInfo> listsubject = null;
            try
            {

                this.progressBarSpot.Visible = true;
                progressBarSpot.Maximum = mainContent1.WordBrowers.document.Paragraphs.Count - 1;
                progressBarSpot.Minimum = 0;
                progressBarSpot.Value = 0;
                progressBarSpot.Step = 10;

                bool haspublicanswer = false;//是否存在全局答案
                //得到匹配的题目列表
                listsubject = martianSpot.subjectSpot(mainContent1.WordBrowers.document, ref this.progressBarSpot, MatchArray.BigSubjectPre, ref haspublicanswer);

                progressBarSpot.Maximum = listsubject.Count;
                progressBarSpot.Step = 1;
                progressBarSpot.Value = 0;

                for (int i = 0; i < listsubject.Count; i++)
                {
                    SubjectInfo subjectInfo = listsubject[i];
                    int start = subjectInfo.paragraphsStart;
                    int end = subjectInfo.paragraphsEnd; ;

                    //设定选择范围
                    mainContent1.WordBrowers.document.Application.Selection.SetRange(start, end);
                    //更新目录栏

                    mainContent1.WordBrowers.document.Application.Selection.Range.Copy();
                    String bigsubjecttext = ClipboardHelper.getClipboardText();

                    string bigSubjectLine = mainContent1.WordBrowers.document.Application.Selection.Range.Text;
                    string subjectname = MatchContent.matchRe(MatchArray.BigSubjectPre, bigsubjecttext);

                    TreeNode subnode = new TreeNode();
                    subnode.Text = subjectname;

                    //设置node在文本中的管理范围
                    Subject subject = new Subject();
                    subject.rangestart = listsubject[i].paragraphsStart;
                    if (i == listsubject.Count - 1)
                    {
                        object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
                        //最后一题将范围移动至文档结束
                        subject.rangeend = mainContent1.WordBrowers.document.Bookmarks.get_Item(ref oEndOfDoc).Range.End;
                    }
                    else
                    {
                        subject.rangeend = listsubject[i + 1].paragraphsStart;
                    }
                    subnode.Tag = subject;
                    this.treeViewSubject.Nodes.Add(subnode);
                    if (isSpotWord)
                    {
                        int temp = 0;//此值在这里无用
                        SubjectBuild(subnode, MatchArray.SubjectPreStructure, ref temp);
                    }

                    //更新进度条
                    progressBarSpot.Value = i;
                    progressBarSpot.PerformStep();
                }
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show("请先在程序中打开word文件。");
            }
            finally
            {
                this.progressBarSpot.Visible = false;
            }
        }
Пример #4
0
        /// <summary>
        /// 英语全局答案分析
        /// </summary>
        /// <param name="subjectstructure"></param>
        /// <param name="endfor"></param>
        /// <param name="fatherID">父题的ID</param>
        /// <returns>返回用来标识是否有子答案</returns>
        private bool englishAnalyseAnswer(SubjectStructure subjectstructure, int startanswer, int endanswer)
        {
            MartianSpot martianSpot = new MartianSpot();
            List<SubjectInfo> listminisubject = null;
            //Subject subject = (Subject)treenode.Tag;

            try
            {

                listminisubject = martianSpot.answerSpot(mainContent1.WordBrowers.document, ref this.progressBarSpot, subjectstructure.subjectPre, startanswer, endanswer);
                if (listminisubject.Count == 0)
                    return false;

                for (int i = 0; i < listminisubject.Count; i++)
                {
                    SubjectInfo subjectInfoStart = listminisubject[i];
                    int start = subjectInfoStart.paragraphsStart;

                    SubjectInfo subjectInfoEnd;
                    int end;
                    if (i == listminisubject.Count - 1)
                    {
                        //subjectInfoEnd = listminisubject[i];
                        //object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
                        //最后一题将范围移动至文档结束
                        end = endanswer;
                    }
                    else
                    {
                        subjectInfoEnd = listminisubject[i + 1];
                        end = subjectInfoEnd.paragraphsStart;
                    }
                    //设定选择范围
                    mainContent1.WordBrowers.document.Application.Selection.SetRange(start, end);
                    //更新目录栏
                    // analyseAnswerSecond(subjectstructure, fatherID, treenode);
                    //获取答案范围
                    mainContent1.WordBrowers.document.Application.Selection.Range.Copy();//包括题目前ID号内容的范围
                    String cliptext = ClipboardHelper.getClipboardText();
                    int prelength = 0;//定义前段返回的字符串

                    string sequencestr = MatchContent.matchRe(subjectstructure.subjectPre, cliptext, ref prelength);
                    int sequence = 1;//试题在套卷中的排序号
                    try
                    {
                        sequence = Int16.Parse(sequencestr);
                    }
                    catch (Exception ex)
                    {
                        sequence = 1;
                    }

                    TreeNode treenodecurrect = englistJudgeAnswerForSubject(sequence);//判断答案对应的树节点
                    if (treenodecurrect == null)
                    {
                    }
                    else
                    {
                        mainContent1.WordBrowers.document.Application.Selection.SetRange(start + prelength, end);
                        Subject treenodecurrectsubject = (Subject)treenodecurrect.Tag;
                        mainContent1.WordBrowers.document.Application.Selection.Range.Copy();//不包括题目前ID号内容的范围
                        String html = ClipboardHelper.getClipboardHtml();
                        HtmlUtil.HtmlPictureMove(ref html);
                        html = HtmlUtil.HtmlFragmentClear(html);
                        treenodecurrectsubject.answer.subjecthtmlanswer = HtmlUtil.htmlreplace(html);
                        //treenodecurrectsubject.answer.subjectbinaryanswer = ClipboardHelper.getClipboardEmbed();
                        treenodecurrectsubject.answer.subjecttextanswer = ClipboardHelper.getClipboardText();
                    }
                }
                return true;
            }
            catch (NullReferenceException ex)
            {
                return false;
                // MessageBox.Show("请先在程序中打开word文件。");
            }
        }
Пример #5
0
        /// <summary>
        /// 
        /// 题目内容建立
        /// </summary>
        /// <param name="treenode">建立所在节点下</param>
        /// <param name="subjectstructure">题目对应匹配结构</param>
        /// <returns> 返回是否有子节点</returns>
        /// 
        private bool SubjectBuild(TreeNode treenode, SubjectStructure subjectstructure, ref int endfor, List<Subject> list2, List<Subject> list3=null,int index=1)
        {
            MartianSpot martianSpot = new MartianSpot();
            List<SubjectInfo> listminisubject = null;
            Subject subject1 = (Subject)treenode.Tag;
            try
            {

                listminisubject = martianSpot.subjectSpot(mainContent1.WordBrowers.document, ref this.progressBarSpot, subjectstructure.subjectPre, subject1.rangestart, subject1.rangeend);
                if (listminisubject.Count == 0)
                    return false;

                for (int i = 0; i < listminisubject.Count; i++)
                {
                    SubjectInfo subjectInfoStart = listminisubject[i];
                    int start = subjectInfoStart.paragraphsStart;
                    if (i == 0)//去第一个子题的头位置
                    {
                        endfor = start;
                    }
                    SubjectInfo subjectInfoEnd;
                    int end;
                    if (i == listminisubject.Count - 1)
                    {
                        //subjectInfoEnd = listminisubject[i];
                        //object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
                        //最后一题将范围移动至文档结束
                        end = subject1.rangeend;
                    }
                    else
                    {
                        subjectInfoEnd = listminisubject[i + 1];
                        end = subjectInfoEnd.paragraphsStart;
                    }

                    Subject subject = new Subject();//创建试题对象

                    subject.rangestart = start;//取得当前范围
                    subject.rangeend = end;//取得当前范围

                    var item = list2.Where(x => x.ParentId == subject1.Id).ToList()[i];
                    subject.ParentId = item.ParentId;
                    subject.Id = item.Id;
                    String cliptext = item.subjecttextcontent;
                    //subject.subjecttextcontent = cliptext;
                    int prelength = 0;//定义前段返回的字符串
                    TreeNode tn = new TreeNode();

                    string sequencestr = MatchContent.matchRe(subjectstructure.subjectPre, cliptext, ref prelength);
                    int sequence = 1;//试题在套卷中的排序号
                    try
                    {
                        sequence = Int16.Parse(sequencestr);
                    }
                    catch (Exception ex)
                    {
                        sequence = 1;
                    }

                    subject.套卷序号 = sequence;

                    //this.webBrowser.DocumentText = html;
                    //subject.subjecthtmlcontent = html;
                    //subject.subjectbinarycontent = ClipboardHelper.getClipboardEmbed();
                    string html = item.subjecthtmlcontent;
                    string[] strs = null;
                    //第一层
                    if (index == 1)
                    {
                        strs  = MatchArray.SubjectPreStructure.subjectPre;
                        //第一层需要去掉第二层的内容
                        var htmls = html.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                        foreach (var itemHtml in htmls)
                        {
                            if (MatchContent.match(MatchArray.SubjectPreStructure.childsubjectStructure.subjectPre, NoHTML(itemHtml)))
                            {
                                html = html.Substring(0, GetStrIndex(html, itemHtml));
                                break;
                            }
                        }

                    }else{ //第二层
                         strs  = MatchArray.SubjectPreStructure.childsubjectStructure.subjectPre;
                    }
                    foreach (var sb in strs)
                    {
                        string tempsb = sb;
                        if (tempsb.IndexOf("^") == 0)
                        {
                            tempsb = tempsb.Substring(1);
                        }
                        var match = Regex.Match(html, tempsb);
                        if (match.Success)
                        {
                            html = html.Replace(match.Groups["pre"].Value, "");
                        }
                    }
                    if (cliptext.Length > 20)
                    {
                        tn.Text = cliptext.Substring(0, 20);
                    }
                    else
                    {
                        tn.Text = cliptext;
                    }
                    tn.Tag = subject;//对应内容属性
                    tn.Expand();

                    treenode.Nodes.Add(tn);
                    treenode.Expand();

                    this.propertyGrid.SelectedObject = subject;

                    if (subjectstructure.childsubjectStructure != null)//判断是否还需判断子题
                    {
                        int subjectend = 0;//结束结束返回
                        bool subjectb = SubjectBuild(tn, subjectstructure.childsubjectStructure, ref subjectend, list3, null,index+1);
                        if (!subjectb)//没有字节点
                        {
                            //end = 0;//结束位置返回
                            //bool bansw = AnswerSpot(ref tn, ref end);
                            //if (bansw)//存在答案。更新题目内容界定范围
                            //{
                            //    mainContent1.WordBrowers.document.Application.Selection.SetRange(subject.rangestart + prelength, end);
                            //}
                            //else
                            //{
                            //    mainContent1.WordBrowers.document.Application.Selection.SetRange(subject.rangestart + prelength, subject.rangeend);
                            //}
                            //mainContent1.WordBrowers.document.Application.Selection.Range.Copy();//不包括题目前ID号内容的范围
                            //String html = ClipboardHelper.getClipboardHtml();
                            HtmlUtil.HtmlPictureMove(ref html);
                            FilterHtmlAndShowInWebbrowser(ref html);
                            //需过滤题号
                            subject.subjecthtmlcontent = html;

                            //subject.subjectbinarycontent = ClipboardHelper.getClipboardEmbed();
                            //需过滤题号
                            subject.subjecttextcontent = item.subjecttextcontent;

                        }
                        else//更新题干或者大题内容范围
                        {
                            //mainContent1.WordBrowers.document.Application.Selection.SetRange(subject.rangestart + prelength, subjectend);
                            //mainContent1.WordBrowers.document.Application.Selection.Range.Copy();//不包括题目前ID号内容的范围
                            //String html = ClipboardHelper.getClipboardHtml();

                            HtmlUtil.HtmlPictureMove(ref html);
                            html = HtmlUtil.HtmlFragmentClear(html);
                            html = HtmlUtil.htmlreplace(html);
                            //if (!isSpot)
                            //{
                            //    if (html != null && !html.Trim().Equals(""))
                            //    {
                            //        try
                            //        {
                            //            this.webBrowser.DocumentText = html;
                            //        }
                            //        catch
                            //        {
                            //            MessageBox.Show("该题无法预览,请重新拆题", "提示");
                            //        }
                            //    }
                            //    //FilterHtmlAndShowInWebbrowser(ref html);
                            //}

                            subject.subjecthtmlcontent = html;
                            //subject.subjectbinarycontent = ClipboardHelper.getClipboardEmbed();
                            //subject.subjecttextcontent = ClipboardHelper.getClipboardText();
                        }
                    }
                    else//没有子节点
                    {
                        end = 0;
                        //bool bansw = AnswerSpot(ref tn, ref end);
                        //if (bansw)//存在答案。更新题目内容界定范围
                        //{
                        //    mainContent1.WordBrowers.document.Application.Selection.SetRange(subject.rangestart + prelength, end);
                        //}
                        //else
                        //{
                        //    mainContent1.WordBrowers.document.Application.Selection.SetRange(subject.rangestart + prelength, subject.rangeend);
                        //}
                        //mainContent1.WordBrowers.document.Application.Selection.Range.Copy();//不包括题目前ID号内容的范围
                        //String html = ClipboardHelper.getClipboardHtml();
                        HtmlUtil.HtmlPictureMove(ref html);
                        html = HtmlUtil.HtmlFragmentClear(html);
                        html = HtmlUtil.htmlreplace(html);
                        //if (!isSpot)
                        //{
                        //    if (html != null && !html.Trim().Equals(""))
                        //    {
                        //        try
                        //        {
                        //            this.webBrowser.DocumentText = html;
                        //        }
                        //        catch
                        //        {
                        //            MessageBox.Show("该题无法预览,请重新拆题", "提示");
                        //        }
                        //    }
                        //    //FilterHtmlAndShowInWebbrowser(ref html);
                        //}
                        subject.subjecthtmlcontent = html;

                        //subject.subjectbinarycontent = ClipboardHelper.getClipboardEmbed();
                        // subject.subjecttextcontent = ClipboardHelper.getClipboardText();
                        subject.subjecttextcontent = item.subjecttextcontent;
                    }

                    //设定选择范围
                    // mainContent1.WordBrowers.document.Application.Selection.SetRange(start, end);
                    //更新目录栏
                    //SubjectContentBuild(true, treenode, subjectstructure);
                }
                return true;
            }
            catch (NullReferenceException ex)
            {
                return false;
                // MessageBox.Show("请先在程序中打开word文件。");
            }
        }
Пример #6
0
        /// <summary>
        /// 生成试题结构树主结构
        /// </summary>
        /// <param name="isSpotWord">区分是否是点击拆分按钮触发的</param>
        private void InitTreeRootNode(bool isSpotWord)
        {
            this.treeViewSubject.SelNodes = null;
            this.treeViewSubject.CheckedNodes = null;
            this.treeViewSubject.Nodes.Clear();
            treeViewSubject.TreeViewNodeSorter = new NodeSorter();//树结构的排序规则
            MartianSpot martianSpot = new MartianSpot();
            List<SubjectInfo> listsubject = null;
            try
            {
                publicanswerstart = 0;
                this.progressBarSpot.Visible = true;
                //this.lableProcess.Visible = true;
                //this.lableProcess.Text = "分析大题";
                //this.lableProcess.Show();
                progressBarSpot.Maximum = mainContent1.WordBrowers.document.Paragraphs.Count - 1;
                progressBarSpot.Minimum = 0;
                progressBarSpot.Value = 0;
                progressBarSpot.Step = 10;

                bool haspublicanswer = false;//是否存在全局答案

                mainContent1.WordBrowers.document.Application.Selection.SetRange(0, mainContent1.WordBrowers.document.Paragraphs[mainContent1.WordBrowers.document.Paragraphs.Count].Range.End);
                mainContent1.WordBrowers.document.Application.Selection.Range.Copy();//不包括题目前ID号内容的范围
                String html = ClipboardHelper.getClipboardHtml();
                HtmlUtil.HtmlPictureMove(ref html);
                html = HtmlUtil.HtmlFragmentClear(html);
                html = HtmlUtil.htmlreplace(html);
                string html1 = "";
                string html2 = "";
                bool isOne = true;
                int index = 0;
                int end = 0;
                foreach (var answer in MatchArray.publicAnswer)
                {
                    end = GetStrIndex(html, "(<p>)*" + answer, false);
                    if (end > 0)
                    {
                        break;
                    }
                }

                if (end > 0)
                {
                    html1 = html.Substring(0, end);
                    html2 = html.Substring(end);
                    haspublicanswer = true;
                }
                else
                {
                    html1 = html;
                }

                List<Subject> list = new List<Subject>();
                var strs = html1.Split(new string[] { "\r\n\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                string tempText = "";
                for (int i = 0; i < strs.Length; i++)
                {
                    string text = NoHTML(strs[i]);
                    if (i == strs.Length - 1 && i != 0)
                    {
                        list.Add(new Subject()
                        {
                            Id = i.ToString(),
                            subjecthtmlcontent = html1.Substring(index),
                            subjecttextcontent = tempText
                        });
                    }
                    else
                    {
                        if (text.ToString().Length > 3)//通过字段长度过滤来提高性能;
                        {
                            if (MatchContent.match(MatchArray.BigSubjectPre, text.ToString().TrimStart()))
                            {
                                if (isOne)
                                {
                                    index = GetStrIndex(html1, strs[i]);
                                    isOne = false;
                                }
                                else
                                {
                                    end = GetStrIndex(html1, strs[i]);
                                    list.Add(new Subject()
                                    {
                                        Id = i.ToString(),
                                        subjecthtmlcontent = html1.Substring(index, end - index),
                                        subjecttextcontent = tempText
                                    });
                                    index = end;
                                }
                                tempText = text;
                            }
                        }
                    }
                }

                List<Subject> list2 = new List<Subject>();
                List<Subject> list3 = new List<Subject>();

                if (isSpotWord)
                {
                    list2 = GetSubjectList(strs, list, MatchArray.SubjectPreStructure.subjectPre);
                    list3 = GetSubjectList(strs, list2, MatchArray.SubjectPreStructure.childsubjectStructure.subjectPre);
                }

                //得到匹配的题目列表
                listsubject = martianSpot.subjectSpot(mainContent1.WordBrowers.document, ref this.progressBarSpot, MatchArray.BigSubjectPre, ref haspublicanswer);

                progressBarSpot.Maximum = listsubject.Count;
                progressBarSpot.Step = 1;
                progressBarSpot.Value = 0;

                for (int i = 0; i < listsubject.Count; i++)
                {
                    SubjectInfo subjectInfo = listsubject[i];

                    //设置node在文本中的管理范围
                    Subject subject = new Subject();

                    subject.rangestart = listsubject[i].paragraphsStart;
                    if (i == listsubject.Count - 1)
                    {
                        if (haspublicanswer)
                        {
                            publicanswerstart = listsubject[i].paragraphsStart;
                            break;
                        }
                        else
                        {
                            object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
                            //最后一题将范围移动至文档结束
                            subject.rangeend = mainContent1.WordBrowers.document.Bookmarks.get_Item(ref oEndOfDoc).Range.End;
                        }
                    }
                    else
                    {
                        subject.rangeend = listsubject[i + 1].paragraphsStart;
                    }
                    string bigsubjecttext = list[i].subjecttextcontent;
                    string subjectname = MatchContent.matchRe(MatchArray.BigSubjectPre, bigsubjecttext);

                    if (subjectname.Length > 200)
                    {
                        subjectname = subjectname.Substring(0, 200);
                    }

                    TreeNode subnode = new TreeNode();
                    subnode.Text = subjectname;
                    subject.套卷序号 = i;
                    subject.选项个数 = 0;
                    subject.Id = list[i].Id;
                    subnode.Tag = subject;
                    //subnode.Tag = section;
                    this.treeViewSubject.Nodes.Add(subnode);
                    if (isSpotWord)
                    {
                        lableProcess.Text = "分析题目";
                        int temp = 0;//此值在这里无用
                        SubjectBuild(subnode, MatchArray.SubjectPreStructure, ref temp, list2, list3);
                    }

                    //更新进度条
                    progressBarSpot.Value = i;
                    progressBarSpot.PerformStep();
                }
                if (isSpotWord && (classtypeenglish.Equals(classtype) || classtypeenglish2.Equals(classtype)))//英语类型判断
                {
                    foreach (TreeNode treenode in this.treeViewSubject.Nodes)//获取所有节点进行判断是否有题进行二次识别
                    {
                        if (treenode.Nodes.Count > 0)
                        {
                        }
                        else
                        {
                            int temp = 0;//此值在这里无用
                            SubjectBuild(treenode, MatchArray.SubjectPreStructure.childsubjectStructure, ref temp, null, null);
                        }
                    }
                }

                GetSubjectAnswer(isSpotWord, html2);
                //publicanswerstart = 0;
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show("请先在程序中打开word文件。", "提示");
            }
            finally
            {
                this.progressBarSpot.Visible = false;
                this.lableProcess.Visible = false;
                lableProcess.Text = "";
            }
        }