コード例 #1
0
ファイル: MartianSimple.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();

            }
            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
ファイル: MartianSimple.cs プロジェクト: Kristd/backup
        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文件。", "提示");
            }
        }