Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/davidgohel/flextable/llms.txt

Use this file to discover all available pages before exploring further.

flextable is an R package that provides a grammar for creating and customizing beautiful tables for reporting and publication. With a single, consistent API you can produce tables for any output format — HTML, PDF, Microsoft Word, PowerPoint, RTF, or R grid graphics.

Quickstart

Create your first flextable in minutes

Installation

Install from CRAN or GitHub

Core Concepts

Understand how flextable works

API Reference

Browse the full function reference

Why flextable?

Most R table packages are tied to a single output format. flextable solves this by providing one API for all formats — the same code that creates your HTML report table also generates your Word document table.

Multi-format

HTML, PDF, Word, PowerPoint, RTF, and R graphics — all from the same code

Fully customizable

Control every cell’s text, borders, colors, fonts, and alignment

R Markdown & Quarto

First-class integration with knitr chunk options

Statistical summaries

Built-in functions for model tables and cross-tabulations

Rich cell content

Embed images, equations, mini-charts, and ggplot2 plots in cells

Composable

Chain formatting verbs with the pipe operator

How it works

A flextable is built from a data.frame and consists of three parts: header, body, and footer. You apply formatting and layout transformations by chaining functions.
library(flextable)

flextable(head(mtcars)) |>
  bold(part = "header") |>
  color(color = "#2B5797", part = "header") |>
  theme_vanilla() |>
  autofit()

Supported output formats

FormatFunctionIntegration
Microsoft Wordsave_as_docx()officer, R Markdown, Quarto
Microsoft PowerPointsave_as_pptx()officer, R Markdown, Quarto
HTMLsave_as_html()R Markdown, Quarto, htmltools
PDF / LaTeX(via knitr)R Markdown, Quarto
RTFsave_as_rtf()officer
PNG / SVGsave_as_image()webshot2, magick
R gridgen_grob()patchwork

Build docs developers (and LLMs) love