Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!
I am still fighting with outlook myappointment.RTFBODY method...
I have found on some page that there is a workround which will give me a possibility to put there html text...
I have tried it, and it wokrs - almost...

C#
webBrowser.CreateControl(); 
webBrowser.DocumentText = html; // HTML = HTML CODE
Application.DoEvents();
webBrowser.Document.ExecCommand("SelectAll", false, null);
webBrowser.Document.ExecCommand("Copy", false, null);
RichTextBox testbox = new RichTextBox();
testbox.Paste(); // PROBLEM LIES HERE


The problem is that .Paste() method paste everything without formating (no colors, pictures - just text + tables)
I need use "paste while maintaining formatting" which is available in every M$ prog..
Still. I dont know how to do that in C#

Please help!
Posted
Updated 8-Apr-13 23:54pm
v2

1 solution

Did you try these?


testbox.Text = Clipboard.GetText(TextDataFormat.Rtf);

OR

DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Html);

if(testbox.CanPaste(myFormat))
{
richTextBox1.Paste(myFormat);
return true;
}

OR

testbox.selectedRtf=Clipboard.GetData(DataFormats.Rtf).ToString();
 
Share this answer
 
v2
Comments
Ayyappan Ravi 9-Apr-13 5:51am    
Hi,

I tried these, these all displays only the text, not the format (color,font,image).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900