Is there a way to copy entire datagridview object to powerpoint slide keeping foratting? I've tried the following code but its give me Clipboard is empty or contains data which may not be pasted
error
PP.Application ppt = new PP.Application();
PP.Presentation pres = ppt.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoTrue);
PP.Slides slides = pres.Slides;
PP.Slide slide = slides.AddSlide(1,pres.SlideMaster.CustomLayouts[PP.PpSlideLayout.ppLayoutText]);
datagridview1.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
datagridview1.SelectAll();
DataObject obj = datagridview1.GetClipboardContent();
Clipboard.SetDataObject(obj, true);
PP.ShapeRange sr = slide.Shapes.Paste();//Error on this line
If there is a way to export the dataGridView as an image, its fine as well. The final user doesn't have to interact with the data. I have tried adding datagridview to picture box, but I couldn't figure out how to bind them together. Thanks,
If you want to have your grid content rendered to an image - check this posting or google for "render wpf control to image". Don't forget to use proper clipboard format id, or use Clipboard.SetImage instead of SetDataObject.