469,142 Members | 1,109 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,142 developers. It's quick & easy.

Copy Richtextbox Data in clip board and pasting On Excel

Hi
I m worki on clip board m trying to copy RTF data(Text+Image) both txt and image on clip board its only pasting text On Excel not the image can any one help me in this regard
I m using your artical
http://www.thescripts.com/forum/thread356836.html
but hasnt workfor me

Const CF_ENHMETAFILE As Integer = 14
Dim henmetafile As IntPtr
Dim metaFile As Imaging.Metafile

If ClipboardAPI.OpenClipboard(Me.Handle) Then
If ClipboardAPI.IsClipboardFormatAvailable(CF_ENHMETA FILE) <> 0 Then
henmetafile = ClipboardAPI.SetClipboardData(CF_ENHMETAFILE, henmetafile)
metaFile = New Imaging.Metafile(henmetafile, True)
ClipboardAPI.CloseClipboard()
nd If
End If
Jun 13 '07 #1
3 4322
shweta123
692 Expert 512MB
Hi,

Please refer this Link



Hi
I m worki on clip board m trying to copy RTF data(Text+Image) both txt and image on clip board its only pasting text On Excel not the image can any one help me in this regard
I m using your artical
http://www.thescripts.com/forum/thread356836.html
but hasnt workfor me

Const CF_ENHMETAFILE As Integer = 14
Dim henmetafile As IntPtr
Dim metaFile As Imaging.Metafile

If ClipboardAPI.OpenClipboard(Me.Handle) Then
If ClipboardAPI.IsClipboardFormatAvailable(CF_ENHMETA FILE) <> 0 Then
henmetafile = ClipboardAPI.SetClipboardData(CF_ENHMETAFILE, henmetafile)
metaFile = New Imaging.Metafile(henmetafile, True)
ClipboardAPI.CloseClipboard()
nd If
End If
Jun 13 '07 #2
Plater
7,872 Expert 4TB
Well, this worked pasting into ms-word just fine but not excel
Expand|Select|Wrap|Line Numbers
  1. RichTextBox rtb = new RichTextBox();
  2. rtb.SelectionBackColor = Color.Red;
  3. rtb.AppendText("hi there, all this text will be background color red");
  4. Clipboard.SetText(rtb.Rtf, TextDataFormat.Rtf);
  5.  
But from there I could select it in ms-word and paste it into excel....
Jun 13 '07 #3
Thankz For Reply
yes u r rite but i want paste image and text (like If thre is an image after some
text i want to copy both txt and image in Excel) Clipboard treat Data as EnhanceMeta Format so how i wll do this can u give me any sample for doing that?
Jun 14 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by an.sally | last post: by
4 posts views Thread by SirCodesALot | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.