문제

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