Click here to Skip to main content
11,479,162 members (62,395 online)
Rate this: bad
good
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 9-Apr-13 0:29am
BEST001421
Edited 9-Apr-13 0:54am
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 at 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
0 Sergey Alexandrovich Kryukov 205
1 F-ES Sitecore 195
2 OriginalGriff 130
3 Frankie-C 120
4 DamithSL 95
0 Sergey Alexandrovich Kryukov 7,890
1 OriginalGriff 7,366
2 Sascha Lefèvre 3,064
3 Maciej Los 2,491
4 Richard Deeming 2,335


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 9 Apr 2013
Copyright © CodeProject, 1999-2015
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