1

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!!

2 Answers2

2

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)

David Gohel
  • 9,180
  • 2
  • 16
  • 34
1

Thanks David!

I understand, but I wanted to have text linking to another slide. Meanwhile I figured out how to do it in this fork: https://github.com/danielinteractive/officer in the function ph_add_text2. Feel free to pull something of this into your package, probably others need this too!

Cheers Daniel