[R] Populating values in a PowerPoint table
Saar Golde
saar at revolutionanalytics.com
Fri Oct 1 02:58:22 CEST 2010
Dear R-help,
I managed (thanks to the R2PPT package) to create a PowerPoint
presentation and create a table in it but for the life of me I can't
find a way to populate the table with values and text. I'm aware of
the function 'PPT.AddDataFrame' which creates an Excel object from a
data frame, but the excel object is not nearly as nice looking and
easy to manipulate (and apply templates to) as an actual PowerPoint
table.
I'd appreciate any help I can get. Thanks!
-Saar
Sample code to create the presentation and the table:
require(R2PPT)
# initialize the presentation
myPres<-PPT.Init(visible=TRUE)
# create title slide
myPres<-PPT.AddTitleSlide(myPres,title="Fancy Title",subtitle="Fancy SubTitle")
# create and select a table slide
myPres$Current.Slide <- comInvoke(comGetProperty(myPres$pres,
"Slides"),"Add", comGetProperty(comGetProperty(myPres$pres, "Slides"),
"Count") + 1, 4)
comInvoke(myPres$Current.Slide, "Select")
# populate the slide's title
slideTitleHanlde <-
comGetProperty(comGetProperty(comGetProperty(comGetProperty(myPres$Current.Slide,
"Shapes"), "Title"), "TextFrame"), "TextRange")
comSetProperty(slideTitleHanlde, "Text", "Table Slide Title")
# Add table to current slide
myShapes <- comGetProperty(myPres$Current.Slide, "Shapes")
myTable1 <- comInvoke(myShapes, "AddTable",7,3)
--
Saar Golde, Ph.D. <saar at revolutionanalytics.com>
Analytics Solutions Architect, Revolution Analytics
101 University Ave, Suite 300, Palo Alto, CA 94306, USA
Tel: +1 (650) 330-0553 x207
More information about the R-help
mailing list