Save a flextable as a png or svg image.
This function uses R graphic system to create an image from the flextable,
allowing for high-quality image output. See gen_grob()
for more options.
save_as_image(x, path, expand = 10, res = 200, ...)
a string containing the full name of the generated file
It's important to note that captions are not part of the table itself. This means when exporting a table to PNG or SVG formats (image formats), the caption won't be included. Captions are intended for document outputs like Word, HTML, or PDF, where tables are embedded within the document itself.
Other flextable print function:
df_printer()
,
flextable_to_rmd()
,
gen_grob()
,
htmltools_value()
,
knit_print.flextable()
,
plot.flextable()
,
print.flextable()
,
save_as_docx()
,
save_as_html()
,
save_as_pptx()
,
save_as_rtf()
,
to_html.flextable()
library(gdtools)
register_liberationsans()
#> [1] TRUE
set_flextable_defaults(font.family = "Liberation Sans")
ft <- flextable(head(mtcars))
ft <- autofit(ft)
tf <- tempfile(fileext = ".png")
save_as_image(x = ft, path = tf)
#> [1] "/tmp/RtmpFOXZ7h/filed4fab594de6f.png"
init_flextable_defaults()