Read placeholders information from powerpoint presentation

read_slide_placeholders(
  pptx,
  index,
  only_slide = FALSE,
  only_layout = FALSE,
  keep_all = FALSE,
  error_call = current_env()
)

Arguments

pptx

A Powerpoint wrapped in a <pptx_container> object. see load_pptx()

index

slide index

only_slide

if TRUE only extract placeholders from the slide, i.e. not from its associated layout

only_layout

if TRUE only extract placeholders from the layout, i.e. not occupied in the slide

keep_all

if FALSE, only keep non missing placeholders

error_call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Examples

ppt <- example_pptx()
read_slide_placeholders(ppt)
#> # A tibble: 19 × 16
#>    slide_index slide_file layout_file  layout_name id     offx  offy    cx    cy
#>          <dbl> <chr>      <chr>        <chr>       <chr> <dbl> <dbl> <dbl> <dbl>
#>  1           1 slide1.xml slideLayout… Title and … 3      0.5  1.75   9    4.95 
#>  2           1 slide1.xml slideLayout… Title and … 2      0.5  0.300  9    1.25 
#>  3           1 slide1.xml slideLayout… Title and … 4      0.5  6.95   2.33 0.399
#>  4           1 slide1.xml slideLayout… Title and … 5      3.42 6.95   3.17 0.399
#>  5           1 slide1.xml slideLayout… Title and … 6      7.17 6.95   2.33 0.399
#>  6           2 slide2.xml slideLayout… Two Content 3      0.5  1.75   4.42 4.95 
#>  7           2 slide2.xml slideLayout… Two Content 4      5.08 1.75   4.42 4.95 
#>  8           2 slide2.xml slideLayout… Two Content 2      0.5  0.300  9    1.25 
#>  9           2 slide2.xml slideLayout… Two Content 5      0.5  6.95   2.33 0.399
#> 10           2 slide2.xml slideLayout… Two Content 6      3.42 6.95   3.17 0.399
#> 11           2 slide2.xml slideLayout… Two Content 7      7.17 6.95   2.33 0.399
#> 12           3 slide3.xml slideLayout… Comparison  2      0.5  0.300  9    1.25 
#> 13           3 slide3.xml slideLayout… Comparison  3      0.5  1.68   4.42 0.700
#> 14           3 slide3.xml slideLayout… Comparison  4      0.5  2.38   4.42 4.32 
#> 15           3 slide3.xml slideLayout… Comparison  5      5.08 1.68   4.42 0.700
#> 16           3 slide3.xml slideLayout… Comparison  6      5.08 2.38   4.42 4.32 
#> 17           3 slide3.xml slideLayout… Comparison  7      0.5  6.95   2.33 0.399
#> 18           3 slide3.xml slideLayout… Comparison  8      3.42 6.95   3.17 0.399
#> 19           3 slide3.xml slideLayout… Comparison  9      7.17 6.95   2.33 0.399
#> # ℹ 7 more variables: ph_type <chr>, ph <glue>, ph_id <chr>,
#> #   slide_ph_name <chr>, slide_ph_id <chr>, layout_ph_name <chr>,
#> #   metadata <list>
read_slide_placeholders(ppt, index = 1)
#> # A tibble: 5 × 16
#>   slide_index slide_file layout_file   layout_name id     offx  offy    cx    cy
#>         <dbl> <chr>      <chr>         <chr>       <chr> <dbl> <dbl> <dbl> <dbl>
#> 1           1 slide1.xml slideLayout2… Title and … 3      0.5  1.75   9    4.95 
#> 2           1 slide1.xml slideLayout2… Title and … 2      0.5  0.300  9    1.25 
#> 3           1 slide1.xml slideLayout2… Title and … 4      0.5  6.95   2.33 0.399
#> 4           1 slide1.xml slideLayout2… Title and … 5      3.42 6.95   3.17 0.399
#> 5           1 slide1.xml slideLayout2… Title and … 6      7.17 6.95   2.33 0.399
#> # ℹ 7 more variables: ph_type <chr>, ph <glue>, ph_id <chr>,
#> #   slide_ph_name <chr>, slide_ph_id <chr>, layout_ph_name <chr>,
#> #   metadata <list>
read_slide_placeholders(ppt, index = 1:2)
#> # A tibble: 11 × 16
#>    slide_index slide_file layout_file  layout_name id     offx  offy    cx    cy
#>          <dbl> <chr>      <chr>        <chr>       <chr> <dbl> <dbl> <dbl> <dbl>
#>  1           1 slide1.xml slideLayout… Title and … 3      0.5  1.75   9    4.95 
#>  2           1 slide1.xml slideLayout… Title and … 2      0.5  0.300  9    1.25 
#>  3           1 slide1.xml slideLayout… Title and … 4      0.5  6.95   2.33 0.399
#>  4           1 slide1.xml slideLayout… Title and … 5      3.42 6.95   3.17 0.399
#>  5           1 slide1.xml slideLayout… Title and … 6      7.17 6.95   2.33 0.399
#>  6           2 slide2.xml slideLayout… Two Content 3      0.5  1.75   4.42 4.95 
#>  7           2 slide2.xml slideLayout… Two Content 4      5.08 1.75   4.42 4.95 
#>  8           2 slide2.xml slideLayout… Two Content 2      0.5  0.300  9    1.25 
#>  9           2 slide2.xml slideLayout… Two Content 5      0.5  6.95   2.33 0.399
#> 10           2 slide2.xml slideLayout… Two Content 6      3.42 6.95   3.17 0.399
#> 11           2 slide2.xml slideLayout… Two Content 7      7.17 6.95   2.33 0.399
#> # ℹ 7 more variables: ph_type <chr>, ph <glue>, ph_id <chr>,
#> #   slide_ph_name <chr>, slide_ph_id <chr>, layout_ph_name <chr>,
#> #   metadata <list>

read_slide_placeholders(ppt, only_slide = TRUE)
#> # A tibble: 3 × 16
#>   slide_index slide_file layout_file   layout_name id     offx  offy    cx    cy
#>         <dbl> <chr>      <chr>         <chr>       <chr> <dbl> <dbl> <dbl> <dbl>
#> 1           1 slide1.xml slideLayout2… Title and … 3      0.5   1.75  9     4.95
#> 2           2 slide2.xml slideLayout4… Two Content 3      0.5   1.75  4.42  4.95
#> 3           2 slide2.xml slideLayout4… Two Content 4      5.08  1.75  4.42  4.95
#> # ℹ 7 more variables: ph_type <chr>, ph <glue>, ph_id <chr>,
#> #   slide_ph_name <chr>, slide_ph_id <chr>, layout_ph_name <chr>,
#> #   metadata <list>
read_slide_placeholders(ppt, index = 2, only_slide = TRUE)
#> # A tibble: 2 × 16
#>   slide_index slide_file layout_file   layout_name id     offx  offy    cx    cy
#>         <dbl> <chr>      <chr>         <chr>       <chr> <dbl> <dbl> <dbl> <dbl>
#> 1           2 slide2.xml slideLayout4… Two Content 3      0.5   1.75  4.42  4.95
#> 2           2 slide2.xml slideLayout4… Two Content 4      5.08  1.75  4.42  4.95
#> # ℹ 7 more variables: ph_type <chr>, ph <glue>, ph_id <chr>,
#> #   slide_ph_name <chr>, slide_ph_id <chr>, layout_ph_name <chr>,
#> #   metadata <list>