RichTextBox: code for displaying images and word

Source: Internet
Author: User

Display image:

Copy codeThe Code is as follows: Image img = Image. FromFile (@ "E: \ image \ bottle \ 2006122013203825344.jpg ");
Clipboard. SetDataObject (img );
RichTextBox. Paste (DataFormats. GetFormat (DataFormats. Bitmap ));
Show word
String filename = @ "d: \ subf.doc ";
// C # reading word file instantiation COM
Microsoft. Office. Interop. Word. ApplicationClass wordApp = new Microsoft. Office. Interop. Word. ApplicationClass ();
Object fileobj = filename;
Object nullobj = System. Reflection. Missing. Value; // open the specified file. (The number of COM parameters varies in different versions. Generally, nullobj is used except the first one)
Microsoft. office. interop. word. document doc = wordApp. documents. open (ref fileobj, ref nullobj, ref upload, ref nullobj, ref nullobj, ref nullobj, ref nullobj); // obtain the text in the doc file.
ResponseFormsMediator. RemindersRichTextBox. Text + = doc. Content. Text; // C # Read the closed word file
Doc. Close (ref nullobj, ref nullobj, ref nullobj); // C # Close COM wordApp. Quit (ref nullobj, ref nullobj, ref nullobj) to read the word file );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.