Click here to Skip to main content
12,502,104 members (51,244 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
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...

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 8-Apr-13 23:29pm
Updated 8-Apr-13 23:54pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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();
  Permalink  
v2
Comments
BEST001 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160919.1 | Last Updated 9 Apr 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100