开发者

Adding a worksheet to a Powerpoint presentation from silverlight

开发者 https://www.devze.com 2023-03-24 20:40 出处:网络
I\'m working on an silverlight client app that will create a powerpoint presentation that contains excel workbook shee开发者_开发问答ts.

I'm working on an silverlight client app that will create a powerpoint presentation that contains excel workbook shee开发者_开发问答ts.

Going through the office api, the best way I can find to do this is to create the excel worksheet programmatically, save to a temp file and then use the AddOLEObject method on the shape object from the powerpoint api.

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.shapes.addoleobject.aspx

Is there a better way to do this?


Once you've created the spreadsheet, copy the desired range to the clipboard, then with your PowerPoint object:

With oPPTPresentation.Slides(SlideIndex)
.Shapes.PasteSpecial (ppPasteOLEObject)
End With

Or if you need to move/size it:

With oPPTPresentation.Slides(SlideIndex)
Set oPPTShape = .Shapes.PasteSpecial(ppPasteOLEObject)(1)
With oPPTShape
End With   ' shape
End With   ' presentation

That's it in a VBA nutshell. Translation to .NETshell left as an exercise for the reader.

0

精彩评论

暂无评论...
验证码 换一张
取 消