ph_add_text

0th

Percentile

append text

append text in a placeholder

Usage
ph_add_text(x, str, type = NULL, id_chr = NULL, style = fp_text(font.size
  = 0), pos = "after", href = NULL, slide_index = NULL)
Arguments
x

a pptx device

str

text to add

type

placeholder type

id_chr

placeholder id (a string). This is to be used when a placeholder type is not unique in the current slide, e.g. two placeholders with type 'body'. Values can be read from slide_summary.

style

text style, a fp_text object

pos

where to add the new element relative to the cursor, "after" or "before".

href

hyperlink to reach when clicking the text

slide_index

slide index to reach when clicking the text. It will be ignored if href is not NULL.

Aliases
  • ph_add_text
Examples
# NOT RUN {
library(magrittr)
fileout <- tempfile(fileext = ".pptx")
my_pres <- read_pptx() %>%
  add_slide(layout = "Title and Content", master = "Office Theme") %>%
  ph_empty(type = "body")

small_red <- fp_text(color = "red", font.size = 14)

my_pres <- my_pres %>%
  ph_add_par(level = 3) %>%
  ph_add_text(str = "A small red text.", style = small_red) %>%
  ph_add_par(level = 2) %>%
  ph_add_text(str = "Level 2")

print(my_pres, target = fileout)


fileout <- tempfile(fileext = ".pptx")
doc <- read_pptx() %>%
  add_slide(layout = "Title and Content", master = "Office Theme") %>%
  ph_with_text(type = "title", str = "Un titre 1") %>%
  add_slide(layout = "Title and Content", master = "Office Theme") %>%
  ph_with_text(type = "title", str = "Un titre 2") %>%
  on_slide(1) %>%
  ph_empty(type = "body") %>%
  ph_add_par(type = "body", level = 2) %>%
  ph_add_text(str = "Jump here to slide 2!", type = "body",
  slide_index = 2)

print(doc, target = fileout)
# }
Documentation reproduced from package officer, version 0.3.2, License: GPL-3

Community examples

Looks like there are no examples yet.