Welcome Guest ( Log In | Click here to Register a free account now! )
Welcome to Bleeping Computer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.![]() ![]() |
Dec 3 2004, 01:04 AM
Post
#1
|
|
|
New Member ![]() Group: Members Posts: 1 Joined: 3-December 04 Member No.: 6,331 |
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. Also, using the following code, I find that the clipped data from MSPaint supports 4 formats ("Embed Source", "Object Descriptor" , "MetaFilePict", and "DeviceIndependentBitmap") but the data I copy from the MemoryStream has only 2 ("System.Drawing.Bitmap" and "Bitmap"). // Code to check formats for clipboad data IDataObject data = Clipboard.GetDataObject(); String[] arrayOfFormats = data.GetFormats(true); Does anyone have any pointers? Thanks, Ajay. ERROR ***** 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. CODE **** // Obtain an image stream in "results", which is Byte[] MemoryStream MemStream = new MemoryStream(results); DataObject d = new DataObject(); d.SetData(DataFormats.Bitmap, true, MemStream); Clipboard.SetDataObject(d, true); PowerPoint.Presentation ppt; PowerPoint.Application pptApp; PowerPoint.Slide slide; pptApp = new PowerPoint.Application(); ppt = pptApp.Presentations.Add(MsoTriState.msoTriStateMixed); slide = ppt.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutBlank); slide.Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPasteDefault,MsoTriState. msoFalse,"",0,"",MsoTriState.msoFalse); ppt.SaveAs("D:\\Ata\\test.ppt", PowerPoint.PpSaveAsFileType.ppSaveAsPresentation, MsoTriState.msoTrue); |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 10th October 2008 - 10:55 PM |