Search code examples
rpowerpointofficer

ph_slidelink - not sure how to use it?


it is great that officer has a function to create links to slides internal to the presentation. However I don't know how to use it from the examples available. I never see an actual hyperlink to a page appearing in the example below e.g.:

fileout <- tempfile(fileext = ".pptx")
doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with_text(x = doc, type = "title", str = "Un titre 1")
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with_text(x = doc, type = "title", str = "Un titre 2")
doc <- on_slide(doc, 1)
slide_summary(doc) # read column id here
doc <- ph_slidelink(x = doc, id_chr = "2", slide_index = 2)

print(doc, target = fileout )

Here I don't see any link for page 2 appearing anywhere... Can you help me? Thanks!!


Solution

  • If you click on "Un titre 1" (with view mode, not edit mode), slide 2 is displayed.

    ph_slidelink(x = doc, id_chr = "2", slide_index = 2): when clicking on shape with id "2", display slide 2 (slide_index = 2)