officer icon indicating copy to clipboard operation
officer copied to clipboard

Add support for `ln` for `external_img`

Open angusmoore opened this issue 1 year ago • 0 comments

Currently (eg v0.4.3) the ln argument to ph_location does not do anything for ph_with when value is an external_img. Eg: the following will not put a red border around the image, despite the sp_line specification.

library(officer)                                                                                                                              

img.file <- file.path( R.home("doc"), "html", "logo.jpg" ) 
ppt <- read_pptx() 
ppt <- add_slide(ppt, layout = "Title and Content", master = "Office Theme")                                                                  

ppt <- ph_with(ppt, value = external_img(img.file, width = 2.78, height = 2.12), location = ph_location(left = 1, top = 2, ln = sp_line("red", lwd = 2)), use_loc_size = FALSE)                                                                                                          

print(ppt, "foo.pptx")

This PR adds support for ln to pic_pml so that images now get borders.

I am not particularly (or, at all) familiar with the guts of office documents, so this may be incorrectly implemented. I just copied the way it was done for sh_props_pml and it seems to work as I'd expect.

angusmoore avatar Aug 10 '22 07:08 angusmoore