I want to copy from word or excel or any other external application into my applications textbox or richtextbox and save and retrieve the data in the same format, this would be used as a message body for sending emails.

Can anybody guide me through this?

有帮助吗?

解决方案

You could get content from Word or Excel (or any other app) in html format end this would be ideal for email :

string data = Clipboard.GetText(TextDataFormat.Html);

You will get html string but with some header in front, look at the links below for examples how to handle it :

http://blogs.msdn.com/b/jmstall/archive/2007/01/21/html-clipboard.aspx

http://theartofdev.wordpress.com/2012/11/11/setting-html-and-plain-text-formatting-to-clipboard/

warning html produced by word is simply horrible so probably there will be problems for some people when viewing such mails with messy html.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top