예제 #1
0
        private void ToolStripMenuItemCreateAnswer_Click(object sender, EventArgs e)
        {
            try
            {

                CCWordApp ccwordapp = new CCWordApp(mainContent1.WordBrowers.document.Application, mainContent1.WordBrowers.document);
                //mainContent1.WordBrowers.document.Application.Selection.Range.InsertParagraphBefore();
                ccwordapp.SetFontSize(14);
                ccwordapp.InsertText("答案:");
                mainContent1.WordBrowers.document.Application.Selection.Range.InsertParagraphAfter();

            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show("请先在程序中打开word文件。");
            }
        }
예제 #2
0
파일: Martian.cs 프로젝트: Kristd/backup
        private void AnswerTableToParagraph()
        {
            try
            {
                CCWordApp ccwordapp = new CCWordApp(mainContent1.WordBrowers.document.Application, mainContent1.WordBrowers.document);

                Microsoft.Office.Interop.Word.Tables table = mainContent1.WordBrowers.document.Application.Selection.Tables;
                if (table.Count == 0)
                {
                    table = mainContent1.WordBrowers.document.Tables;
                }

                foreach (Microsoft.Office.Interop.Word.Table t in table)
                {
                    if (publicanswerstart > 0 && t.Range.Start > publicanswerstart)
                    {
                        List<String> tableanswer = ccwordapp.AnswerTableToParagraph(t);

                        mainContent1.WordBrowers.document.Application.Selection.SetRange(t.Range.Start, t.Range.End);
                        object what = Microsoft.Office.Interop.Word.WdGoToItem.wdGoToLine;
                        object missing = System.Reflection.Missing.Value;
                        mainContent1.WordBrowers.document.Application.Selection.GoTo(ref what, ref missing, ref missing, ref missing);
                        mainContent1.WordBrowers.document.Application.Selection.SetRange(t.Range.Start, t.Range.End);
                        t.Delete();
                        foreach (String str in tableanswer)
                        {
                            ccwordapp.SetFont();
                            ccwordapp.SetFontSize(14);
                            ccwordapp.InsertText(str);
                            ccwordapp.InsertLineBreak();
                            //ccwordapp.oWordApplic.Selection.Range.InsertParagraphAfter();
                            //mainContent1.WordBrowers.document.Application.Selection.Range.InsertParagraphAfter();
                        }
                        break;
                        //ccwordapp.InsertText(tableanswer);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
예제 #3
0
        private void buttonInsertBigSubject_Click(object sender, EventArgs e)
        {
            CreateBigSubject a = new CreateBigSubject();
            DialogResult da = a.ShowDialog(this);
            if (da.Equals(DialogResult.OK))
            {
                try
                {

                    CCWordApp ccwordapp = new CCWordApp(mainContent1.WordBrowers.document.Application, mainContent1.WordBrowers.document);
                    //mainContent1.WordBrowers.document.Application.Selection.Range.InsertParagraphBefore();
                    ccwordapp.SetFont("Bold");
                    ccwordapp.SetFontSize(14);
                    ccwordapp.InsertText(a.ComboBoxBigSubject.Text);
                    mainContent1.WordBrowers.document.Application.Selection.Range.InsertParagraphAfter();

                }
                catch (NullReferenceException ex)
                {
                    MessageBox.Show("请先在程序中打开word文件。");
                }
            }
            a.Dispose();
        }
예제 #4
0
파일: Martian.cs 프로젝트: Kristd/backup
        private void ToolStripMenuItemCreateAnswer_Click(object sender, EventArgs e)
        {
            try
            {
                CCWordApp ccwordapp = new CCWordApp(mainContent1.WordBrowers.document.Application, mainContent1.WordBrowers.document);
                mainContent1.WordBrowers.document.Application.Selection.Range.InsertParagraphBefore();
                ccwordapp.SetFontSize(14);
                ccwordapp.InsertText("答案:");
                mainContent1.WordBrowers.document.Application.Selection.Range.InsertParagraphAfter();
                //ccwordapp.testmethod();

                //using (EditorForm editor = new EditorForm(webBrowser.DocumentText))
                //{
                //    editor.ShowDialog(this);
                //}

                //webBrowser.Navigate("E:\\workspace\\导题工具\\Martian\\bin\\Debug\\ueditor1_2_1_0-utf8-net\\_examples\\completeDemo.html");
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show("请先在程序中打开word文件。", "提示");
            }
        }