423,822 Members | 1,356 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,822 IT Pros & Developers. It's quick & easy.

Copy Richtextbox Data in clip board and pasting On Excel

P: 4
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
Share this Question
Share on Google+
3 Replies


shweta123
Expert 100+
P: 692
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
Expert 5K+
P: 7,872
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

P: 4
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.