0

layout_properties ( x = my_pres, layout = "Comparison", master = "Office Theme" ) master_name name type id ph_label ph offx offy 3 Office Theme Comparison body 13 Text Placeholder 12 5.0625000 4.8298611 9 Office Theme Comparison body 4 Content Placeholder 3 0.3927734 1.7009799 11 Office Theme Comparison body 11 Text Placeholder 10 0.3923611 4.8290453 12 Office Theme Comparison body 6 Content Placeholder 5 5.0625000 1.7009799 15 Office Theme Comparison body 5 Text Placeholder 4 5.0625011 1.2482754 16 Office Theme Comparison body 3 Text Placeholder 2 0.3927734 1.2583486 20 Office Theme Comparison dt 7 Date Placeholder 6 0.3927734 5.2135422 25 Office Theme Comparison ftr 8 Footer Placeholder 7 3.3125000 5.2135422 30 Office Theme Comparison sldNum 9 Slide Number Placeholder 8 7.3553718 5.2135422 34 Office Theme Comparison title 2 Title 1 0.392773

Couldn't find a nice way of formatting thsi but as you can see the type body has id of 13.

Now when I try to code this in:

GSK_Comparison <- function(PP,title,sub1,sub2,footer, table1,table2){
  PP <- PP %>% 
    add_slide(layout = "Comparison", master = "Office Theme") %>%
    ph_with_text(type = "title", str = title) %>%
    ph_with_text(type = "body",index = 11, str = sub1) %>%
    ph_with_flextable(value = table1,type= "body",index = 4) %>%
    ph_with_text(type = "body",index = 13, str = sub2) %>%
    ph_with_flextable(value = table2, type = "body", index = 6) %>%
    ph_with_text(type = "dt", str = format(Sys.Date())) %>%
    ph_with_text(type = "ftr",str = footer)
}

I get the following error message: Error in slide$get_location(type = type, index = index) : body can only have 6 element(s) but index is set to 11

But not sure why this is occuring as clearly there are ID's of 11 and 13 for the type of body

Thanks in advance!

Zuti
  • 85
  • 8
  • `index` is placeholder index (integer). This is to be used when a placeholder type is not unique in the current slide, e.g. two placeholders with type 'body', the first one will be added with index 1 and the second one with index 2. – David Gohel Dec 27 '18 at 10:11
  • Thanks - I have now looked at it and got it working but wondered how you defined indexes. will these always be in the order of index so index of 11 would be 5 and 13 would always be 6? I just tried all options to find out where they should be, but wondered if there was a set way - thanks for your help – Zuti Dec 27 '18 at 17:43
  • I don't know why you are using 5, or 13, etc. It always starts with 1 in a slide, if you have two body placeholders, their index will be 1 and 2. – David Gohel Dec 28 '18 at 14:12

0 Answers0