When I put more than nine objects on a slide, the newest objects default to vertical (this happens with text, not sure about plots or images). My company does have a habit of putting too much information on the slide, but they want to keep the same format, if at all possible. I wasn't sure if the ReporteRs package had an option to set the maximum number of objects or maybe this is an issue with one of the dependencies to run the package. I will attach a screenshot and the code. I created a blank document titled Presentation1.pptx and put that in my working directory.
Code:
library("ReporteRs")
pres <- pptx(template = "Presentation1.pptx")
pres <- addSlide(pres, slide.layout = 'Blank')
pres <- addParagraph(par.properties = parProperties(),
doc = pres, text.align = "left", value = pot("SOME TEXT",
textBold(color = "black", font.size = 36, font.family = "Arial")),
offx = 0.5, offy = 0, width = 0, height = 1)
pres <-addParagraph(par.properties = parProperties(list.style = "unordered", level = 1),
doc = pres, text.align = "left", value = pot("Some Text",
textBoldItalic(color = "black", font.size = 21, font.family = "Arial")),
offx = 0.25, offy = 1, width = 0, height = 1)
pres <-addParagraph(par.properties = parProperties(list.style = "unordered", level = 2),
doc = pres, text.align = "left", value = pot("Some Text",
textBoldItalic(color = "black", font.size = 17, font.family = "Arial")),
offx = 0.75, offy = 1.5, width = 0, height = 1)
pres <-addParagraph(par.properties = parProperties(list.style = "unordered", level = 2),
doc = pres, text.align = "left", value = pot("Some Text",
textBoldItalic(color = "black", font.size = 17, font.family = "Arial")),
offx = 0.75, offy = 2, width = 0, height = 1)
pres <-addParagraph(par.properties = parProperties(list.style = "unordered", level = 1),
doc = pres, text.align = "left", value = pot("Some Text",
textBoldItalic(color = "black", font.size = 21, font.family = "Arial")),
offx = 0.25, offy = 2.5, width = 0, height = 1)
pres <-addParagraph(par.properties = parProperties(list.style = "unordered", level = 2),
doc = pres, text.align = "left", value = pot("Some Text",
textBoldItalic(color = "black", font.size = 17, font.family = "Arial")),
offx = 0.75, offy = 3, width = 0, height = 1)
pres <-addParagraph(par.properties = parProperties(list.style = "unordered", level = 2),
doc = pres, text.align = "left", value = pot("Some Text",
textBoldItalic(color = "black", font.size = 17, font.family = "Arial")),
offx = 0.75, offy = 3.5, width = 0, height = 1)
pres <-addParagraph(par.properties = parProperties(list.style = "unordered", level = 2),
doc = pres, text.align = "left", value = pot("Some Text",
textBoldItalic(color = "black", font.size = 17, font.family = "Arial")),
offx = 0.75, offy = 4, width = 0, height = 1)
pres <-addParagraph(par.properties = parProperties(list.style = "unordered", level = 2),
doc = pres, text.align = "left", value = pot("Some Text",
textBoldItalic(color = "black", font.size = 17, font.family = "Arial")),
offx = 0.75, offy = 4.5, width = 0, height = 1)
pres <-addParagraph(par.properties = parProperties(list.style = "unordered", level = 2),
doc = pres, text.align = "left", value = pot("Some Text",
textBoldItalic(color = "black", font.size = 17, font.family = "Arial")),
offx = 0.75, offy = 5, width = 0, height = 1)
pres <-addParagraph(par.properties = parProperties(list.style = "unordered", level = 2),
doc = pres, text.align = "left", value = pot("Copyright Text",
textBoldItalic(color = "black", font.size = 17, font.family = "Arial")),
offx = 3, offy = 7, width = 0, height = 1)
writeDoc(pres, file = "pres.pptx")
First, move to package officer
if possible and read that page: https://davidgohel.github.io/officer/articles/powerpoint.html#append-text-sequentially-in-a-shape.
In you script, you are using widths set to 0 and a new shape for each new paragraph. text.align
is not an argument of addParagraph. So let' simplify:
library(ReporteRs)
pres <- pptx()
pres <- addSlide(pres, slide.layout = 'Title and Content')
style_36 <- textBold(color = "black", font.size = 36, font.family = "Arial")
style_17 <- textBoldItalic(color = "black", font.size = 17, font.family = "Arial")
style_21 <- textBoldItalic(color = "black", font.size = 21, font.family = "Arial")
par_lev_1 <- parProperties(list.style = "unordered", level = 1)
par_lev_2 <- parProperties(list.style = "unordered", level = 2)
par_lev_3 <- parProperties(list.style = "unordered", level = 3)
pres <- addParagraph(par.properties = parProperties(), doc = pres, value = pot("SOME TEXT", style_36),
offx = 0.5, offy = 0, width = 8, height = 6)
pres <-addParagraph(par.properties = par_lev_1, append = TRUE,
doc = pres, value = pot("Some Text", style_21) )
pres <-addParagraph(par.properties = par_lev_2, append = TRUE,
doc = pres, value = pot("Some Text", style_17) )
pres <-addParagraph(par.properties = par_lev_2, append = TRUE,
doc = pres, value = pot("Some Text", style_17) )
pres <-addParagraph(par.properties = par_lev_3, append = TRUE,
doc = pres, value = pot("Some Text", style_21) )
pres <-addParagraph(par.properties = par_lev_2, append = TRUE,
doc = pres, value = pot("Some Text", style_17) )
pres <-addParagraph(par.properties = par_lev_2, append = TRUE,
doc = pres, value = pot("Some Text", style_17) )
pres <-addParagraph(par.properties = par_lev_2, append = TRUE,
doc = pres, value = pot("Some Text", style_17) )
pres <-addParagraph(par.properties = par_lev_2, append = TRUE,
doc = pres, value = pot("Some Text",style_17) )
pres <-addParagraph(par.properties = par_lev_2, append = TRUE,
doc = pres, value = pot("Some Text", style_17) )
pres <-addParagraph(par.properties = par_lev_3, append = TRUE,
doc = pres, value = pot("Copyright Text", style_21) )
writeDoc(pres, file = "pres.pptx")