Is there an easy way to copy a DataView (or even the DataGrid showing the DataView) to the Clipboard

  • Thread starter Thread starter Kevin Brown
  • Start date Start date
K

Kevin Brown

I simply want to copy the DataView and paste it into an email. What's the
best way to accomplish that? I could obviously write the XML to a string
and copy the string, but that's "ugly" for an email.

Thanks.
 
You could take the XML string, and perform an XSL transform on it to turn
into any format you like with any type of formatting.
 
Kevin,

A dataview is only an object that hold references to datarowview which again
reference to items in a datatable, so pasting it in a email will even when
you got it to the reader let the readoer over the internet give the one who
reads the message give the reference to your computer.

A serialized dataset should be very simple in my opinion to paste in.

However creating just a nice text or html message from it looks for me much
nicer for the one who has to read it. The last is of course my own opinion.

I hope this helps?

Cor
 
Cor said:
Kevin,

A dataview is only an object that hold references to datarowview
which again reference to items in a datatable, so pasting it in a
email will even when you got it to the reader let the readoer over
the internet give the one who reads the message give the reference to
your computer.

A serialized dataset should be very simple in my opinion to paste in.

However creating just a nice text or html message from it looks for
me much nicer for the one who has to read it. The last is of course
my own opinion.

I hope this helps?

Cor

Ok - I created an HTML table to represent the data and copied it to the
clipboard. However, if I switch to Outlook and paste into a new message, I
see nothing. The code I wrote was:

(build the string...)

Encoding enc = Encoding.UTF8;

DataObject obj = new DataObject();
obj.SetData(DataFormats.Html, new
System.IO.MemoryStream(enc.GetBytes(str)));
Clipboard.SetDataObject(obj, true);

What's wrong?
 
Kevin,

And you did that in 12 minutes after that I wrote my message. Maybe you try
to find the answer first yourself?

Cor
 
Back
Top