Functions for Tabular Reporting

Create pretty tables for 'HTML', 'PDF', 'Microsoft Word' and 'Microsoft PowerPoint' documents from 'R Markdown'. Functions are provided to let users create tables, modify and format their content. It also extends package 'officer' that does not contain any feature for customized tabular reporting.

BuildStatus Buildstatus CRAN_Status_Badge cranlogs codecov Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped.

The flextable package provides a framework for easily create tables for reporting. Tables can be embedded within:

  • R Markdown documents with support for HTML, Word and PowerPoint documents.
  • Microsoft Word or PowerPoint documents.

An API is available to let R users create tables for reporting and control their formatting properties and their layout. A flextable object is a data.frame representation, it can be manipulated with functions that give control over:

  • header, body and footer content
  • text, paragraphs, cells and border formatting of any element
  • displayed values

There are articles on the flextable website that will help you get you to start quickly:

The help pages can be read here.



You can get the development version from GitHub:



Online documentation

The help pages are located at

Getting help

This project is developped and maintained on my own time. If you have questions about how to use the package, visit Stackoverflow and use tags flextable and r Stackoverflow link! I usually read them and answer when possible.

Contributing to the package

Code of Conduct

Anyone getting involved in this package agrees to our Code of Conduct.

Bug reports

When you file a bug report, please spend some time making it easy for me to follow and reproduce. The more time you spend on making the bug report coherent, the more time I can dedicate to investigate the bug as opposed to the bug report.

Contributing to the package development

A great way to start is to contribute an example or improve the documentation.

If you want to submit a Pull Request to integrate functions of yours, please provide:

  • the new function(s) with code and roxygen tags (with examples)
  • a new section in the appropriate vignette that describes how to use the new function
  • corresponding tests in directory tests/testthat.

By using rhub (run rhub::check_for_cran()), you will see if everything is ok. When submitted, the PR will be evaluated automatically on travis and appveyor and you will be able to see if something broke.


flextable 0.5.1


  • fix issue with font colors in powerpoint
  • fix issues with colors for Windows RStudio viewer

new features

  • new themes functions theme_alafoli() and theme_vader()
  • new functions align_text_col() and align_nottext_col() to align columns by data type
  • new functions merge_h_range() to merge a set of columns row by row
  • new functions fix_border_issues() fix issues with borders when cells are merged
  • new functions add_header_row(), add_footer_row(), add_header_lines() and add_footer_lines() to add easily data in header or footer.
  • new generic function as_flextable() to let develop new flextable functions
  • new function as_grouped_data() and its method as_flextable() to create row titles to separate data in a flextable.

flextable 0.5.0


  • new arguments values for functions set_header_labels and set_formatter
  • styles functions now support injection of more than a single value
  • this version a big refactoring and got rid of R6

new features

  • new function compose that will replace display
  • new function set_caption only available for html output

flextable 0.4.7

new features

  • knit_print() can be used with rmarkdown when rendering to PowerPoint.


  • fix issue with regulartable and logical columns

flextable 0.4.6

new features

  • a new helper function body_replace_flextable_at_bkm to replace a bookmarked paragraph by a flextable.
  • new functions colformat_* to make content formatting easier. It also deals with NA.


  • Documentation format.flextable method so that users can create their components.
  • new knitr chunk options ft.align to align tables in rmarkdown::word_document and ft.split to activate Word option 'Allow row to break across pages'.


  • fix issue (unordered and duplicated chunk of text) in function display()

flextable 0.4.5


  • flextable will not be split across rows at a page break in Word documents.


  • fix border rendering with vline()
  • empty data.frame are no more generating an error

flextable 0.4.4

new features

  • Soft return \n is now supported. Function autofit and dim_pretty do not support soft returns and may return wrong results (\n will be considered as "").
  • format function for flextable objects.


  • fix border rendering with border_outer()

flextable 0.4.3

new features

  • new functions: hyperlink_text() to be used with display, font()
  • new functions hline*() and vline*() and many new helper functions to be used instead of borders.


  • manuals have been refactored


  • fix display issue when a cell was containing NA

flextable 0.4.2

new features

  • new function xtable_to_flextable() that is returning a flextable from an xtable object.
  • function htmltools_value() is exported for shiny applications.

flextable 0.4.1

new features

  • flextables have now a footer part

flextable 0.4.0

new features

  • new function knit_print() to render flextable in rmarkdown.


  • function tabwid() is deprecated in favor of a knit_print implementation.
  • list of dependencies has been reduced.

flextable 0.3

new features

  • new function regulartable, faster and simpler than flextable


  • characters <, > and & are now html encoded
  • fix columns widths when output format is HTML

flextable 0.2

new features

  • new function ph_with_flextable_at to add a flextable at any position in a slide.
  • new function merge_at is providing a general way of merging cells.
  • new theme function: theme_box()


  • function display() now works with a mustache template


  • fix fontsize when part == "all"

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.6.9 by David Gohel, 16 days ago,

Report a bug at

Browse source code at

Authors: David Gohel [aut, cre] , Clementine Jager [ctb] , Quentin Fazilleau [ctb] , Maxim Nazarov [ctb] (rmarkdown for docx output) , Titouan Robert [ctb] , Michael Barrowman [ctb] (inline footnotes) , Atsushi Yasumoto [ctb] (support for bookdown cross reference) , Paul Julian [ctb] (support for gam objects)

Documentation:   PDF Manual  

Task views: Reproducible Research

GPL-3 license

Imports stats, utils, grDevices, graphics, officer, rmarkdown, knitr, htmltools, xml2, data.table, uuid, gdtools, rlang, base64enc

Suggests testthat, xtable, webshot, magick, ggplot2, scales, broom, mgcv, bookdown, equatags, commonmark

Imported by DescrTab2, EpiReport, MCPModPack, SWMPrExtension, WordR, augmentedRCBD, compareGroups, concurve, crosstable, eoffice, ftExtra, inTextSummaryTable, interactionR, microplot, onbrand, presenter, processR, repmod, rrtable,, ubiquity, warabandi, webr, ztable.

Suggested by Mediana, basictabler, clinUtils, gtsummary, huxtable, modelsummary, munsellinterpol, nlmixr, officedown, prismadiagramR, rtables, strand, table1.

See at CRAN