I've been having great luck with customizing flextable
tables in my R Markdown documents. However, I am struggling to change the location of a table on the page. It seems the tables are centered on the page by default. I'd like one of my tables aligned to the left margin. How do I do that?
alignment of a flextable on the page when rendering R Markdown to MS Word
I have just added an option to enable that. Now you can use chunk option ft.align
---
output: word_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
```{r ft.align="left"}
library(flextable)
regulartable(cars)
```
This solution doesn't seem to work for html output. Is there a way to align flextables on the left site in html? –
Foulard
no, it does apply to word but i can extend that to html, no problem –
Reflect
I would very much appreciate that, thanks in advance. –
Foulard
@Foulard this is now implemented with html output, you need to update the package from github to try it (it will go on cran later) –
Reflect
I ran into the same problem and the solution worked just fine after updating "flextable" from 0.5.4 and 0.5.5 to get this to work.
© 2022 - 2024 — McMap. All rights reserved.
body_add_flextable()
has analign=
argument. Does that work? – Ulanebody_add_flextable
is not designed to be used inside an R Markdown document (as far as I can tell). – Occamft.align="left"
in the chunk option part and voilà! – Reflectsave_as_docx
? I usually have a list of flextables and want to save them directly in a .docx file. The resulting docx file has all tables centered – Sandalwood