Skip to contents

Save a flextable as a png or svg image.

Usage

save_as_image(x, path, expand = 10, res = 200, ...)

Arguments

x

a flextable object

path

image file to be created. It should end with '.png' or '.svg'.

expand

space in pixels to add around the table.

res

The resolution of the device

...

unused arguments

Value

a string containing the full name of the generated file

Examples

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/Rtmp2lYAUD/file2a97dabb9da.png"

init_flextable_defaults()