I am attempting to use bookmarks in Word to automatically place plots into a report.
I have already used “body_replace_flextable_at_bkm” to add flextables automatically, however I cannot find a function to do so for plots. I saw “replace_external_img” but not plot!
Here is what I tried, but obviously it did not work because the plots are not external images:
<code>template <- read_docx("C:/Users/Documents/template.docx")
body_replace_img_at_bkm(template,"plot1",plot1) # bookmark is named plot1, as well as the R plot
print(template,target="C:/Users/Documents/template.docx")
</code>
<code>template <- read_docx("C:/Users/Documents/template.docx")
body_replace_img_at_bkm(template,"plot1",plot1) # bookmark is named plot1, as well as the R plot
print(template,target="C:/Users/Documents/template.docx")
</code>
template <- read_docx("C:/Users/Documents/template.docx")
body_replace_img_at_bkm(template,"plot1",plot1) # bookmark is named plot1, as well as the R plot
print(template,target="C:/Users/Documents/template.docx")
Output: Error in body_replace_img_at_bkm(template, “plot1”, plot1) :
inherits(value, “external_img”) is not TRUE