Install from CRAN
The stable release of flextable is available on CRAN. Install it with:Install the development version
The development version is hosted on GitHub and may include new features and fixes not yet on CRAN:The development version may be less stable than the CRAN release. Use it if you need a specific recent fix or feature that has not been released yet.
Dependencies
flextable imports the following packages, which are installed automatically from CRAN:| Package | Minimum version | Purpose |
|---|---|---|
data.table | 1.13.0 | Fast internal data manipulation |
gdtools | 0.5.0 | Font metrics and text rendering |
htmltools | — | HTML generation |
knitr | — | R Markdown / Quarto integration |
officer | 0.7.3 | Word and PowerPoint document creation |
ragg | — | High-quality PNG rendering |
rlang | — | Tidy evaluation utilities |
rmarkdown | 2.0 | R Markdown document rendering |
uuid | 0.1-4 | Unique identifiers for table elements |
xml2 | — | XML manipulation for Open XML formats |
graphics, grDevices, grid | — | R base graphics |
stats, utils | — | R base utilities |
Optional packages
The following packages extend flextable’s capabilities. Install them as needed:Image and PDF export
Image and PDF export
webshot2— save tables as PNG or SVG imagesmagick— image processingpdftools— read and manipulate PDF files
Statistical summaries
Statistical summaries
as_flextable() to convert model objects from common modelling packages.ggplot2 and patchwork integration
ggplot2 and patchwork integration
gen_grob() with patchwork to combine flextables and ggplot2 plots in a single figure.officedown (enhanced R Markdown for Word)
officedown (enhanced R Markdown for Word)
officedown extends R Markdown with additional Word layout controls and works closely with flextable.bookdown cross-references
bookdown cross-references
Load the package
After installation, load flextable in your R session:Check the installed version
R Markdown setup
flextable works in R Markdown documents without any extra configuration — just load the package in a setup chunk and print the flextable object in a code chunk.Chunk options for captions
flextable supports knitr chunk options for table captions without needing to callset_caption() directly:
| Option | Description |
|---|---|
tab.cap | Caption text |
tab.id | Caption bookmark or cross-reference ID |
tab.cap.style | Word style name for the caption paragraph |
tab.topcaption | Display caption above the table (default TRUE) |
Verify the installation
Run this snippet to confirm everything is working:Next steps
Quickstart
Create and export your first flextable
Global defaults
Set font, color, and layout defaults once for all tables