Inner and outer borders

library(flextable)

We will first define two types of borders, the first will be used for the outer borders and the second will be used for the inner borders.

big_border = fp_border_default(color="red", width = 2)
small_border = fp_border_default(color="gray", width = 1)

To be sure there is no borders when starting, you can use function border_remove().

ft <- flextable(head(airquality))
ft <- border_remove(x = ft)
ft

Now let’s apply outer and inner borders with functions border_outer(), border_inner_v() and border_inner_h().

ft <- border_inner_h(ft, part="all", border = small_border )
ft <- border_inner_v(ft, part="all", border = small_border )
ft <- border_outer(ft, part="all", border = big_border )
ft