我正在尝试使用官员向PowerPoint添加包含图像的灵活对象。但是图像消失了。我可以使用David发布的hear
示例重现此问题library(flextable)
library(tibble)
download.file("https://www.r-project.org/logo/Rlogo.png", destfile = "Rlogo.png")
pupil.tbl <- tribble(
~col1, ~col2, ~col3,
"A", "B", "Rlogo.png",
"C", "D", "Rlogo.png"
)
pupil.tbl <- as.data.frame(pupil.tbl)
# display only col1 and col2
pupil.ft <- flextable(pupil.tbl, col_keys = c("col1", "col2") )
add_img_to_flextable <- function(ft, i, j){
display(
ft, i=i, col_key = j, pattern = "{{att_tbl}}",
formatters = list(# use col3 even if not displayed
att_tbl ~ as_image(col3, src = col3, width = 1.29, height = 1)
)
)
}
pupil.ft <- add_img_to_flextable(pupil.ft, i = 2, j = "col2")
如果我跑:
print(pupil.ft,preview='html')
print(pupil.ft,preview='docx')
一切正常,但在PPTX格式中,图像不再显示 打印(pupil.ft,预览= 'PPTX')
这是PowerPoint的已知限制吗?有没有解决方法如何在表格中显示图像?
谢谢,
菲利普
答案 0 :(得分:0)
这是PowerPoint的已知限制,它无法处理单元格中的图像