Click here to Skip to main content
15,905,776 members
Home / Discussions / C#
   

C#

 
GeneralPicture Box Pin
camposeo792-Dec-04 0:55
camposeo792-Dec-04 0:55 
GeneralRe: Picture Box Pin
Stefan Troschuetz2-Dec-04 1:35
Stefan Troschuetz2-Dec-04 1:35 
GeneralRe: Picture Box Pin
Robin Panther2-Dec-04 7:28
Robin Panther2-Dec-04 7:28 
GeneralMessage Filtering Pin
A T I F2-Dec-04 0:01
A T I F2-Dec-04 0:01 
GeneralRe: Message Filtering Pin
A T I F2-Dec-04 0:03
A T I F2-Dec-04 0:03 
GeneralRe: Message Filtering Pin
Mike Dimmick2-Dec-04 0:24
Mike Dimmick2-Dec-04 0:24 
GeneralRe: Message Filtering Pin
A T I F2-Dec-04 19:43
A T I F2-Dec-04 19:43 
GeneralError When Copying from Clipboard to PowerPoint slide Pin
GandalfTheWhite1-Dec-04 22:56
GandalfTheWhite1-Dec-04 22:56 
Hello,

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. 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);
GeneralThreads in C# Pin
Member 5834331-Dec-04 21:54
Member 5834331-Dec-04 21:54 
GeneralRe: Threads in C# Pin
Stefan Troschuetz1-Dec-04 22:44
Stefan Troschuetz1-Dec-04 22:44 
GeneralRe: Threads in C# Pin
Member 5834331-Dec-04 22:57
Member 5834331-Dec-04 22:57 
GeneralRe: Threads in C# Pin
Sebastian Schneider3-Dec-04 1:06
Sebastian Schneider3-Dec-04 1:06 
Generallocal Server Pin
radasys1-Dec-04 21:26
radasys1-Dec-04 21:26 
GeneralC# and Flash Pin
Zamolxes1-Dec-04 21:09
Zamolxes1-Dec-04 21:09 
GeneralRe: C# and Flash Pin
Mridang Agarwalla2-Dec-04 1:24
Mridang Agarwalla2-Dec-04 1:24 
GeneralInterface as parameter Pin
El'Cachubrey1-Dec-04 20:48
El'Cachubrey1-Dec-04 20:48 
GeneralRe: Interface as parameter Pin
mav.northwind2-Dec-04 3:51
mav.northwind2-Dec-04 3:51 
Generalpls help me with Globalization Pin
lijukv1-Dec-04 20:15
lijukv1-Dec-04 20:15 
GeneralRe: pls help me with Globalization Pin
Skynyrd1-Dec-04 20:43
Skynyrd1-Dec-04 20:43 
GeneralCrystal report and Windows 98 Pin
GA-BOYZ1-Dec-04 20:14
GA-BOYZ1-Dec-04 20:14 
QuestionDataGridColumnStyle Question? Pin
Old Gun1-Dec-04 18:00
Old Gun1-Dec-04 18:00 
GeneralAVI Audio Compression Pin
Member 23318841-Dec-04 16:26
Member 23318841-Dec-04 16:26 
GeneralDataGrid accepts keypress event Pin
Rebecca Gao1-Dec-04 15:37
Rebecca Gao1-Dec-04 15:37 
GeneralRe: DataGrid accepts keypress event Pin
Daniel Turini1-Dec-04 20:19
Daniel Turini1-Dec-04 20:19 
GeneralRe: DataGrid accepts keypress event Pin
Rebecca Gao1-Dec-04 23:59
Rebecca Gao1-Dec-04 23:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.