Seems like a bug to me, do you accept a workaround where we save the flextable as HTML and take a webshot
screenshot?
library(dplyr)
library(flextable)
library(webshot)
test <- data.frame(
Spalte1 = 1:5,
Spalte2 = letters[1:5],
Spalte3 = c(TRUE, FALSE, TRUE, FALSE, TRUE),
Spalte4 = rnorm(5))
tmp <- tempfile(fileext = ".html")
test %>% flextable() %>%
add_header_row(colwidths = c(2,2), values = c("eins", "zwei")) %>%
align(align = "center", part = "all") %>%
border_remove() %>%
vline(j = 2) %>%
save_as_html(path = tmp)
webshot::webshot(
tmp,
file = "test.png",
vwidth = 300, # play with the width
vheight = 200, # play with the height
zoom = 2 # controlls resolution
)
unlink(tmp) # cleanup temporary html
giving