Search code examples
r-markdownflextable

Using RMarkdown and Flextable to produce a table in Word with the property 'Allow row to break across pages'


I use Flextable with R Markdown to produce tables in word documents.

I am looking for a way to produce the table so that when it is in Word the table property 'Allow row to break across pages' is turned on. I have tried to do this by modifying the template document which defines the text styles for R Markdown but I cant get this to work.

Is there a way to modify the code (example below) so the resulting table in Word has the property 'Allow row to break across pages' turned on?

```{r table}
data <- iris[c(1:3, 51:53, 101:104),]
library(flextable)
data<-regulartable(data)
data
```

Solution

  • You need to use a chunk option ft.split=TRUE:

    ```{r ft.split=TRUE}
    library(flextable)
    data<-regulartable(head(iris))
    data
    ```