S
Steven Van Dyke
Hi,
I have an array of items, each having an image and description. I would like
to programatically copy them all to the clipboard (for pasting into say a
Word document). I've tried the following code, thinking SetData keeps
appending info to the clipboard, but when I paste into Word, I only get the
last description from the last item in my list (no images). What am I doing
wrong here?
private void CopySelectedItemsToClipboard()
{
IDataObject ido = new DataObject();
foreach MyItems myItem in items)
{
if (myItem.selected)
{
ido.SetData(DataFormats.Bitmap, myItem.image);
ido.SetData(DataFormats.Text, myItem.description);
}
}
Clipboard.SetDataObject(ido, true);
Steve
I have an array of items, each having an image and description. I would like
to programatically copy them all to the clipboard (for pasting into say a
Word document). I've tried the following code, thinking SetData keeps
appending info to the clipboard, but when I paste into Word, I only get the
last description from the last item in my list (no images). What am I doing
wrong here?
private void CopySelectedItemsToClipboard()
{
IDataObject ido = new DataObject();
foreach MyItems myItem in items)
{
if (myItem.selected)
{
ido.SetData(DataFormats.Bitmap, myItem.image);
ido.SetData(DataFormats.Text, myItem.description);
}
}
Clipboard.SetDataObject(ido, true);
Steve