2

I'm entering the task of creating automated reports using R.

I have all the data that I need in a dataframe, and I have a template of the report in pptx format. The PPT has quite some design, so I'm preparing the slides instead of working with a layout pattern to make it easier. Slides have some pre-written paragraphs, and I need to insert data into specific positions of those paragraphs: for example, in one text box it says "in this case, there is a "value1"% of ..." and I would need to replace the "value1" tag with its correct value from my dataframe. I also need to insert graphs.

So, I've been trying out the Office package. I see that it lets me open an existing .pptx file, read it's contents and add new slides or objects into existing slides, but is there a way to edit an existing paragraph and replace a word such as "value1" with the specific value I need?

Thanks a lot!

  • Can you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) please. Specifically, what you have done with the `officer` package so far? – Conor Neilson Mar 10 '20 at 21:57
  • Hi Conor. My question was more theorical than practical in nature, that's why I didn't include specific code or files. After posting the question I continued trying out options and found a way to solve what I needed. But I understand this about the package: it is possible to add new objetcs with text to a slide (using for example the ph_with function), and add text to existing objects in the slide (using for example the add_text function) , but I didn't find a way to edit or replace existing text in existing objects... I don't know if I'm missing something about the package... – Sebastian Schurmann Mar 12 '20 at 19:37
  • 1
    @SebastianSchurmann did you find something about your question ? I'm faced the same problem, Thx – Mostafa90 Aug 25 '21 at 23:17

0 Answers0