rflextableofficerline-spacing

Removing all line spacing from a flextable using flextable and officer packages in R


How do you remove all line spacing in a flextable when creating a flextable using the flextable package and printing it into a powerpoint document using the officer package in R?

By default it appears to have line spacing 1.0 with spacing 2 pt before and 2 pt after. How do I get it so I have spacing 0 pt before and 0 pt after?

Thanks a lot!


Solution

  • You can use function padding for that:

    library(flextable)
    library(magrittr)
    
    flextable(head(iris)) %>% 
      padding(padding = 0, part = "all") %>% 
      autofit() %>% 
      print(preview = "pptx")