显示图像:
代码如下:
Image img = Image.FromFile( @"E:/image/bottle/2006122013203825344.jpg" );
Clipboard.SetDataObject( img );
RichTextBox.Paste( DataFormats.GetFormat( DataFormats.Bitmap ) );
显示word
string filename = @"d:/随笔.doc";
//C#读取word文件之实例化COM
Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
object fileobj = filename;
object nullobj = System.Reflection.Missing.Value; //打开指定文件(不同版本的COM参数个数有差异,一般而言除第一个外都用nullobj就行了)
Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open( ref fileobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj ); //取得doc文件中的文本
ResponseFormsMediator.RemindersRichTextBox.Text += doc.Content.Text; //C#读取word文件之关闭文件
doc.Close( ref nullobj, ref nullobj, ref nullobj ); //C#读取word文件之关闭COM wordApp.Quit( ref nullobj, ref nullobj, ref nullobj );
新闻热点
疑难解答
图片精选