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

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.
 
M

Marina

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.
 
C

Cor Ligthert

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
 
K

Kevin Brown

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?
 
C

Cor Ligthert

Kevin,

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

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top