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.DocumentText = html; // HTML = HTML CODE
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!

Re: Paste from clipobard problem c# 80 80

try using this code:

    testBox.Text = Clipboard.GetText(TextDataFormat.Rtf);
Re: Paste from clipobard problem c# 80 80

Will check it after work - thx!

Re: Paste from clipobard problem c# 80 80

Unfortnuanetly problem is still there. I have modified the code:

testBox.Rtf = Clipboard.GetText(TextDataFormat.Rtf);

The result is the same...Text is pasted in, tables are pasted in, but no colors and pictures.

The funniest thing is that content is stillin clipboard..So if i enter (for ex.) Word, and press CTRL+V...Everything is pasted in correctly :(..

Still dunno how to do that in C#

Re: Paste from clipobard problem c# 80 80

I have found out that I need to use WORD inspector in order to copy mail.Body to appointment.Body
I have the code which will do that , but its in VB :(
Can you help me how to do that in c#?

Sub CopyFullBody(sourceItem As Object, targetItem As Object)
    Dim objDoc As Word.Document
    Dim objSel As Word.Selection
    Dim objDoc2 As Word.Document
    Dim objSel2 As Word.Selection
    On Error Resume Next
    ' get a Word.Selection from the source item
    Set objDoc = sourceItem.GetInspector.WordEditor
    If Not objDoc Is Nothing Then
        Set objSel = objDoc.Windows(1).Selection
        Set objDoc2 = targetItem.GetInspector.WordEditor
        If Not objDoc2 Is Nothing Then
            Set objSel2 = objDoc2.Windows(1).Selection
            objSel2.PasteAndFormat wdPasteDefault
            MsgBox "Could not get Word.Document for " & _
        End If
        MsgBox "Could not get Word.Document for " & _
    End If
    Set objDoc = Nothing
    Set objSel = Nothing
    Set objDoc2 = Nothing
    Set objSel2 = Nothing
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.