471,082 Members | 722 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,082 software developers and data experts.

Error When Copying from Clipboard to PowerPoint Slide


I am trying to copy the contents of the output of SQL Reporting Services to
a PowerPoint slide. For this, I am using SQL Reporting Services to obtain an
IMAGE stream, which I paste to the Windows clipboard. Then, using automation,
I am trying to copy this information from the clipboard to a PowerPoint
slide. However, I get an error at slide.Shapes.PasteSpecial.

I am able create a System.Drawing.Bitmap object from the memory stream that
I associate with the image stream. I can also copy an image fragment that I
clipped in MSPaint (which means it's on the clipboard) to PowerPoint using
Automation. And if I generate a CSV stream from Reporting Services, I can
copy this to the clipboard and from there to Excel. It's only that I don't
seem to be able to copy anything from the clipboard to PowerPoint if I pasted
it to the clipboard using the MemoryStream.

Does anyone have any pointers?



An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in WindowsApplication2.exe

Additional information: Shapes (unknown member) : Invalid request.
Clipboard is empty or contains data which may not be pasted here.


// Obtain an image stream in "results", which is Byte[]

MemoryStream MemStream = new MemoryStream(results);
DataObject d = new DataObject();
d.SetData(DataFormats.Tiff, MemStream);
Clipboard.SetDataObject(d, true);

PowerPoint.Presentation ppt;
PowerPoint.Application pptApp;
PowerPoint.Slide slide;
pptApp = new PowerPoint.Application();
ppt = pptApp.Presentations.Add(MsoTriState.msoTriStateMi xed);

slide = ppt.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutBlank)
slide.Shapes.PasteSpecial(PowerPoint.PpPasteDataTy pe.ppPasteDefault,MsoTriState.msoFalse,"",0,"",Mso TriState.msoFalse);
PowerPoint.PpSaveAsFileType.ppSaveAsPresentation, MsoTriState.msoTrue);
Nov 22 '05 #1
0 2226

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by WillRead | last post: by
1 post views Thread by bsg92150 | last post: by
reply views Thread by akshar108 via DotNetMonster.com | last post: by
1 post views Thread by chrizstone | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.