0

This R script loads three version of the same image and uses officer functions to create a word document that has them. The pos option after puts one image after the other, but does so with a return after each so they appear stacked. How do I make them side-by-side?

library(officer)
doc <- read_docx()
f1 = f2 = f3 = system.file("ex/elev.tif", package="terra") 
for (i in c(f1, f2, f3)) {
  doc <- body_add_img(doc, src = i, width = 3, height = 3, pos = "after")
}
print(doc, target = "graphics/testLayout.docx")
M--
  • 25,431
  • 8
  • 61
  • 93
JerryN
  • 2,356
  • 1
  • 15
  • 49
  • this might be helpful https://stackoverflow.com/questions/38741930/side-by-side-plotting-in-reporters-using-addimage – AdroMine May 30 '23 at 18:25
  • This example uses ReporteRs, which is the old version of officer, and uses functions which must be in ReporteR. Do you know of a way to do this in officer? – JerryN May 30 '23 at 19:07
  • https://davidgohel.github.io/officer/reference/index.html#word-sections you can check the function reference page. From the above answer, sections/tables can be created using `section_columns` and `table_layout` – AdroMine May 30 '23 at 19:48

0 Answers0