I'm trying to apply a Word style (table or paragraph) to a flextable object. My motivation is to find a way to stop a flextable from splitting across rows at a page break when outputted to a Word .docx document via knitr. For example, in the following code I've attempted to apply the "Table of Figures" paragraph style to a flextable in R markdown:
---
title: " "
output:
word_document: default
---
<div custom-style = "Table of Figures">
```{r, echo = F, message = F}
library(flextable)
library(magrittr)
head(cars) %>%
regulartable
```
</div>
However, this doesn't seem to work. Does anyone know how to apply table and/or paragraph styles to a flextable object?
Sorry, that's not the way flextable
are working. Formats and properties are managed by flextable functions (i.e. padding
, align
, etc.).
However, I modified the renderer so that rows won't be split across pages in Word document (you will need to update from Github devtools::install_github("davidgohel/flextable")
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With