I have been trying to modify text elements in some particular slides of my PowerPoint using officeR package. However, I can only add a new slide and add text boxes etc. to it. Is it possible to edit an existing slide with all the formatting, text boxes unchanged and insert text only at the location where I want?
A similar question has been asked but it's been unanswered. Is there a way to edit existing paragraphs in slides using officer (or any other alternative) in R?
My template is shown in the figure and I would like to enter text into the two blank text boxes based on the inputs (Saliency, Authority in this example). I have used layout properties and slide summaries to narrow down the slides that need changes but I could not edit locations in those particular slides. Please let me know if this can be solved using any other package or even a different language.
My R code is as follows
library(officer)
library(tidyverse)
load("Friction_Slide_Template.rda") #Fixed template to select the slides
load("Fluency_Slide_Template.rda") #Fixed template to select the slides
excel <- read_csv("Database.csv") #Database based on which I would make changes in ppt
ppt <- read_pptx("Cowry Template Azim Edit .pptx") #Template of ppt
slide_vec <- vector()
j = 1
#Finds the slide index where I have to make changes
for(i in 1:length(ppt)){
temp <- slide_summary(ppt, index = i)
if(sum(temp$ph_label == fric$ph_label) == 10){
slide_vec[j] = i
j = j + 1
}
else{}
}
#Making changes in the slides
for (i in slide_vec){
#Getting the content
content <- slide_summary(ppt, index = i)
#Getting the 'inputs' from user
factor_1 <- content$text[which(content$ph_label == "Text Placeholder 6")]
factor_2 <- content$text[which(content$ph_label == "Text Placeholder 8")]
#Finding the row in our database for our first factor
row_id_1 <- which(excel$Factor == factor_1)
ph_label_1 <- "Text Placeholder 7"
#Adding the text into our slides
ppt %>%
add_slide(layout = "Friction Slide") %>%
ph_with(value = excel$Theory[row_id_1], location = ph_location_label(ph_label_1)) %>%
on_slide(index = j)
}
I tried to create a new slide and add the elements there, but not all layout properties are being copied into the new slide. Thanks in advance