[英]Adding a worksheet to a Powerpoint presentation from silverlight
I'm working on an silverlight client app that will create a powerpoint presentation that contains excel workbook sheets. 我正在使用Silverlight客户端应用程序,该应用程序将创建包含excel工作簿表的PowerPoint演示文稿。
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. 通过Office api,我能找到的最好方法是以编程方式创建excel工作表,保存到临时文件,然后在powerpoint api上对shape对象使用AddOLEObject方法。
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.shapes.addoleobject.aspx http://msdn.microsoft.com/zh-cn/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: 创建电子表格后,将所需范围复制到剪贴板,然后复制PowerPoint对象:
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. 简而言之,就是VBA。 Translation to .NETshell left as an exercise for the reader.
剩下的翻译成.NETshell是读者的练习。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.