C# 如何在富文本框中打开包含图像和项目符号的word文件

C# 如何在富文本框中打开包含图像和项目符号的word文件,c#,winforms,office-interop,C#,Winforms,Office Interop,您好,我正在通过“打开”对话框在富格文本框中打开word文件2007.doc文件。 它工作正常,但图像和项目符号不会显示在富文本框中。 我想在富文本框中打开包含图像和项目符号的word文件 我用这段代码打开一个word文件,并将其逐句转换为 Microsoft.Office.Interop.Word.ApplicationClass wordObject = new Microsoft.Office.Interop.Word.ApplicationClass(); object File = t

您好,我正在通过“打开”对话框在富格文本框中打开word文件2007.doc文件。 它工作正常,但图像和项目符号不会显示在富文本框中。 我想在富文本框中打开包含图像和项目符号的word文件

我用这段代码打开一个word文件,并将其逐句转换为

Microsoft.Office.Interop.Word.ApplicationClass wordObject = new Microsoft.Office.Interop.Word.ApplicationClass();
object File = txtfilepath.Text; //this is the path
object nullobject = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Application wordobject = new Microsoft.Office.Interop.Word.Application();
wordobject.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone;
Microsoft.Office.Interop.Word._Document docs = wordObject.Documents.Open(ref File, ref nullobject, ref nullobject, ref nullobject,
                ref nullobject, ref nullobject, ref nullobject, ref nullobject,
                ref nullobject, ref nullobject, ref nullobject, ref nullobject,
                ref nullobject, ref nullobject, ref nullobject, ref nullobject);
                docs.ActiveWindow.Selection.WholeStory();
                docs.ActiveWindow.Selection.Copy();
                IDataObject data = Clipboard.GetDataObject();
                rtbgermanfile.Text = data.GetData(DataFormats.Text).ToString();
                string name = rtbgermanfile.Text.Trim();
                name = String.Join(Environment.NewLine, name.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries));
                string newtext = name.Replace("\n\n", "\n");
                string newtext2 = newtext.Replace("\n\n", "\n");
                rtbgermanfile.Text = newtext2.ToString();
                txtwriteingerman.Text = rtbgermanfile.Lines[0];
                docs.Close(ref nullobject, ref nullobject, ref nullobject);
                wordobject.Quit(ref nullobject, ref nullobject, ref nullobject);
                //wordobject.Quit(SaveChanges:false, OriginalFormat: false, RouteDocument: false);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(wordobject);

我认为这并不那么容易。RTF或ANSI是富文本框的文本数据格式,如果我没有记错的话,可能是任何TextDataFormat类型。我不能和ANSI交谈,但RTF不是一个很好的工具

建议使用单词本身

但是,如果RTF检查这一个如何做的提示