Excellent that works!! Thanks for the help.
Wayne -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Erich Neuwirth Sent: 20 November 2007 09:13 To: R (D)COM and RExcel server related issues Subject: Re: [Rcom-l] Example exporting R graph to Powerpoint This code works. ppt<-comCreateObject("Powerpoint.Application") comSetProperty(ppt,"Visible",TRUE) myPresColl<-comGetProperty(ppt,"Presentations") myPres<-comInvoke(myPresColl,"Add") mySlides<-comGetProperty(myPres,"Slides") mySlide<-comInvoke(mySlides,"Add",1,12) myShapes<-comGetProperty(mySlide,"Shapes") myPicture<-comInvoke(myShapes,"AddPicture", "c:\\work\\myPicture.jpeg",0,-1,80,80,600,400) Markus Gesmann wrote: > Dear Wayne, > > Wouldn't it be sufficient to know how to insert a picture file into > PowerPoint via rcom? > The following VBA code does that: > > ' VBA PowerPoint > Sub InsertGraphicOnSlide() > Dim ppApp As PowerPoint.Application > Dim ppPres As PowerPoint.Presentation > Dim ppShape As PowerPoint.Shape > Dim ppCurrentSlide As PowerPoint.Slide > Set ppApp = CreateObject("PowerPoint.Application") > ppApp.Visible = True > Set ppPres = ppApp.Presentations.Add(msoTrue) > Set ppCurrentSlide = ppPres.Slides.Add(Index:=1, _ > Layout:=ppLayoutBlank) > With ppCurrentSlide.Shapes > ' Adds a picture to slide 1 in the active presentation. > Set oPicture = .AddPicture("C:\Temp\test.jpg", _ > msoFalse, msoTrue, 0.5, 0.5, 1, 1) > ' Now scale the image > oPicture.ScaleHeight 1, msoTrue > oPicture.ScaleWidth 1, msoTrue > End With > End Sub > > > Unfortunately I do not know how to translate this into rcom, but it should be > something like: > > library(rcom) > ppt <- comCreateObject("PowerPoint.Application") > shape <- comCreateObject("PowerPoint.Shape") > pres <- comInvoke(comGetProperty(ppt,"Presentations"),"Add") > slide <- comInvoke(comGetProperty(pres,"Slides"),"Add",1,2) > > # along the lines, but does not work > shape <- > comSetProperty(comInvoke(comGetProperty(slide,"Shapes"),"AddPicture"), > "C:\\Test\\test.jpg", "msoFalse", "msoTrue", 0.5, 0.5, 1, 1) > comSetProperty(comGetProperty(shape, "ScaleHeight"), 1, "msoTrue") > comSetProperty(comGetProperty(shape, "ScaleWidth"), 1, "msoTrue") > comSetProperty(ppt,"Visible",TRUE) > > > Kind regards, > > Markus > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL > PROTECTED] > Sent: 19 November 2007 12:14 > To: rcom-l@mailman.csd.univie.ac.at > Subject: [Rcom-l] Example exporting R graph to Powerpoint > > > Hi everyone, > Im trying to learn more about using rcom to generate powerpoint > presenatations. > I have found a few examples on how to do some basic stuff: > http://mailman.csd.univie.ac.at/pipermail/rcom-l/2006-December/001363.html > http://www.mf.uni-lj.si/ibmi/biostat-center/gradiva/Lajovic_pptizr.html > http://sunsite.univie.ac.at/rcom/download/deprecated/rexcel.pdf > Does anyone have an example of directly exporting an R graph into Powerpoint > using rcom? > > Regards, > > Wayne > > ---------------------------------------------------------------------------------------- > Wayne Jones > Statistical Consultant > Shell Global Solutions (UK) > Shell Technology Centre Thornton, P.O. Box 1, Chester CH1 3SH, United Kingdom > Tel: +44 (0) 151 373 5977 > Fax: +44 (0) 151 373 5384 > Mobile: +44 (0) 7896 536026 > Email: [EMAIL PROTECTED] > Internet: www.shell.com/globalsolutions/statisticsandchemometrics > > Shell Global Solutions (UK) is a division of Shell Research Limited which has > its Registered Office at Shell Centre, London SE1 7NA and is registered in > England & Wales with No.539964. > > > This message is intended for the personal and confidential use for the > designated recipient(s) named above. If you are not the intended recipient > of this message you are hereby notified that any review, dissemination, > distribution or copying of this message is strictly prohibited. This > communication is for information purposes only and should not be regarded as > an offer to sell or as a solicitation of an offer to buy any financial > product, an official confirmation of any transaction or as an official > statement of Libero Ventures Ltd. Email transmissions cannot be guaranteed > to be secure or error-free. Therefore we do not represent that this > information is complete or accurate and it should not be relied upon as such. > All information is subject to change without notice. > _______________________________________________ > Rcom-l mailing list > Rcom-l@mailman.csd.univie.ac.at > http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l > More information (including a Wiki) at http://rcom.univie.ac.at > > _______________________________________________ Rcom-l mailing list Rcom-l@mailman.csd.univie.ac.at http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l More information (including a Wiki) at http://rcom.univie.ac.at _______________________________________________ Rcom-l mailing list Rcom-l@mailman.csd.univie.ac.at http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l More information (including a Wiki) at http://rcom.univie.ac.at