[R] RDCOMclient copy excel chart to powerpoint

Patrick Doelp p.f.doelp at gmail.com
Tue Aug 16 17:08:16 CEST 2016


I'm currently working on a project that requires me to create charts in
and copy them to a powerpoint presentation. I've been using the RDCOMclient
package to build the charts in excel. I'm now working on actually moving the
charts from excel to powerpoint and I can't seem to figure it out. I've
included some code below (excluding the function that actually creates the
chart as that actually works).

I know that there are better ways to create presentations (ggplot2 and
ReporteRs or just markdown) but the project has some specific requirements
that are met through this method.


# Connect and create workbook/presentation
excel.connect      <- COMCreate("Excel.Application")
powerpoint.connect <- COMCreate("Powerpoint.Application")

excel.workbook          <- excel.connection[["Workbooks"]]$Add()
powerpoint.presentation <- powerpoint.connection[["Presentations"]]$Add()

# Create Chart, return chart COM object
excel.chart.com <- excel.chart(data, aesthetics) # This works so i'm not
including the code
Also creates a new sheet

# Move to powerpoint
excel.to.powerpoint <- function(chart.com,
powerpoint.connect) {
    # Create Slide
    powerpoint.slide <- powerpoint.connect[["Slides"]]$Add(1,12)

    # Copy Chart

    # Select Slide

    # Paste
    # I've tried a few things here (not all listed) including:
    # But I cant seem to get it to work.


Does anyone have any suggestions?

Thank you,
Patrick Doelp

	[[alternative HTML version deleted]]

More information about the R-help mailing list