79690008

Date: 2025-07-04 10:11:01
Score: 1
Natty:
Report link

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

out

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-1):
Posted by: Tim G