1

After kniting a Bookdown project into a .docx file, the - excellent - flextable package made tables in my .docx document with MS-Word 'Normal Style', which has very large interline and is supposed to define the text, nor the tables' cells.

Please, how can I made a flextable table with 1.0 interline or how can I made the flextable tables in the same style than the knitr::kable() ?

The knitr::kable() behavior is to define the MS-Word 'Compact Style' for the entire table, after knitting to .docx. This behavior of knitr::kable produce tables with simple interlines, in my case (vs. the 'Normal Style' for flextable tables with 1.5 interlines). The following image is an example of these differences, in my .docx output. kablevsflextable

  1. It seems that it's not possible to apply a MSWord style on a flextable object, and we have to set the police size and font by adding font(), etc. But flextable::padding(padding = 0) doesn't define interline. Maybe I'm wrong on this point ? There is a way to define interlines for a table, or set the same MSWord style for all the tables produced with flextable ?

Thanks a lot, un très grand merci.

Phil
  • 7,287
  • 3
  • 36
  • 66
Clément LVD
  • 648
  • 5
  • 12

1 Answers1

0

It seems that the - wonderful - flextable package is now able to set interline efficiently, with flextable::line_spacing(). So, for a table with only a single line of text in each row (like in the example above), you have to add:

line_spacing(x = flextable_object, space = 0.8, part = "body")

This work well for tables with one single line of text in each cell. If there is several lines of text in a single row, be aware that flextable::line_spacing() affect the line spacing of these several lines of text in a row, in addition to the global line spacing between the lines of the table.

Thanks a lot David G.

Clément LVD
  • 648
  • 5
  • 12