# NOT RUN {
doc.filename = "addSlide_example.pptx"
doc <- pptx()
doc <- addSlide(doc, "Title and Content")
doc <- addTitle(doc, "Title example")
writeDoc( doc, file = doc.filename )
# }
# NOT RUN {
# demo slide replacement --------
# }
# NOT RUN {
# define 2 FlexTables
ft1 = vanilla.table( mtcars[1:6,] , add.rownames = TRUE )
ft2 = vanilla.table( iris[1:10,], add.rownames = TRUE )
# create an doc to be used as template later
mydoc = pptx( )
mydoc = addSlide( mydoc, slide.layout = "Title and Content")
mydoc = addTitle( mydoc, "a table")
mydoc = addFlexTable( mydoc, ft1 )
mydoc = addSlide( mydoc, slide.layout = "Title and Content")
mydoc = addTitle( mydoc, "some text")
mydoc = addParagraph( mydoc, "text example" )
writeDoc( mydoc, "template_example.pptx" )
# use file pp_template_example.pptx as template
# and replace slide 1
mydoc = pptx(template = "template_example.pptx" )
mydoc = addSlide( mydoc, slide.layout = "Title and Content", bookmark = 1)
mydoc = addTitle( mydoc, "a new table")
mydoc = addFlexTable( mydoc, ft2 )
writeDoc( mydoc, "slide_replacement.pptx" )
# }
Run the code above in your browser using DataLab