Microsoft Word and PowerPoint Documents Generation

Create 'Microsoft Word' document (>=2007) and 'Microsoft PowerPoint' document (>=2007) from R. There are several features to let you format and present R outputs ; e.g. Editable Vector Graphics, functions for complex tables reporting, reuse of corporate template document. You can use the package as a tool for fast reporting and as a tool for reporting automation. The package does not require any installation of Microsoft product to be able to write Microsoft files.

ReporteRs is an R package for creating Microsoft Word and Powerpoint documents. It does not require any Microsoft component to be used. It runs on Windows, Linux, Unix and Mac OS systems. It is designed to automate reporting generation from R.

Important note

ReporteRs will be maintained but will not evolve anymore. It has been rewritten with no java dependency:

  • The new package is officer.
  • FlexTable objects are now implemented in package flextable.
  • Vector graphics are now implemented in package rvg
  • Native Microsoft charts can be produced with package mschart


You can use the package as a tool for fast reporting and as a tool for reporting automation.

There are several features to let you format and present R outputs, for example:

  • Editable Vector Graphics: let your readers modify and annotate plots.
  • Tables: FlexTable objects let you format any complex table.
  • Text output: format texts and paragraphs.
  • Reuse of corporate template document (*.docx and *.pptx).

Produce a document in few lines of codes

There are default templates and default values, it enables easy generation of R outputs in few lines of codes.

Below a short R script:

require( ggplot2 )
doc = docx( title = 'My document' )
doc = addTitle( doc , 'First 5 lines of iris', level = 1)
doc = addFlexTable( doc , vanilla.table(iris[1:5, ]) )
doc = addTitle( doc , 'ggplot2 example', level = 1)
myggplot = qplot(Sepal.Length, Petal.Length, data = iris, color = Species, size = Petal.Width )
doc = addPlot( doc = doc , fun = print, x = myggplot )
doc = addTitle( doc , 'Text example', level = 1)
doc = addParagraph( doc, 'My tailor is rich.', stylename = 'Normal' )
writeDoc( doc, "demo.docx" )

Reporting automation

It lets you also create corporate documents, creation of complex tables, pretty graphical rendering with a set of R functions.

To automate document generation only R code is necessary.

With Word and PowerPoint document, you can add contents from R but also replace contents. By default, content is added at the end of the specified template document. When generating Word document, bookmarks can be used to define locations of replacements in the document. When generating PowerPoint document, slide indexes can be used to define locations of slides to replace in the presentation.


ReporteRs needs rJava with a java version >= 1.6 ; make sure you have an installed JRE.

system("java -version") should return java version ‘1.6.0’ or greater.

Test your rJava installation with the following code, you should get your java version in a string:

#> [1] 0
#> [1] "1.8.0_31"

Get CRAN version


From Github



Online documentation

The help pages are located at

Getting help

This project is developped and maintained on my own time. In order to help me to maintain the package, do not send me private emails if you only have questions about how to use the package. Instead, visit Stackoverflow, ReporteRs has its own tag Stackoverflow link! I usually read them and answer when possible.

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.


ReporteRs 0.8.9

  • modification of SystemRequirements in DESCRIPTION file.

ReporteRs 0.8.8


  • bookmarks were lost after replacement in a docx
  • fix raster issue in editable plots when there were more than one image to render.


  • declareTitlesStyles has been renamed map_title
  • addMarkdown has been deleted
  • bsdoc has been deleted

ReporteRs 0.8.7

Deprectaded function

  • bsdoc is deprecated. The API has no more reason to be maintained as rmarkdown and many other solutions are offering better.
  • addMarkdown.pptx has been deleted
  • addMarkdown.docx and addMarkdown.bsdoc are deprecated


  • fix an issue with addParagraph.pptx that was overwriting all paragraphs globally
  • force DrawningML instructions to be read as UTF-8


  • addPlot.bsdoc does not support vector graphic anymore.

ReporteRs 0.8.6


  • set addPlot default background color to transparent.
  • add support for ggiraph plots.
  • add color opacity (not available for Word)


  • fix an issue with addParagraph.pptx that was overwriting all paragraphs globally
  • force DrawningML instructions to be read as UTF-8

ReporteRs 0.8.5


  • pptx shapes inherits visual properties with addParagraph
  • some help files have been rewritten
  • FlexTable and pot now have their knitr_print method
  • docx gained a new argument empty_template used to clear template content.

ReporteRs 0.8.4


  • package rvg support raster function.
  • Word TOC can now display from one to nine level of titles (suggested by Elena Salette).


  • Graphics Devices have been dropped, package rvg is now producing the graphics. It solves issue #91.

ReporteRs 0.8.3


  • new mathjax option fo bsdoc objects (proposed by David Hajage)

ReporteRs 0.8.2


  • new function as.HTML for bsdoc objects. It return the raw HTML of a bsdoc document. (suggested by Tyler Beason)

  • new functions to let make the plot interactive when graphical device is 'raphael'.

  • function raphael.html now returns a list with javascript instructions, HTML code and id values.


  • fix an encoding issue in pptx with bullets (reported by Jonathan Oxborrow)

  • fix an issue with NA values in FlexTable (reported by Vadim Bondarenko)

  • the package is now configured so that headless mode is always true.

ReporteRs 0.8.1


  • add CodeBlock for vertabim output

  • add pot_img function to add inline images to pot objects


  • docx FlexTable headers were not repeated along pages.

ReporteRs 0.8.0


  • Now always run java in UTF-8. For example, it make possible to use any layout name within PowerPoint templates.


  • There are major corrections in graphic devices with UTF-8 text and text positions. (reported by John Ehrlinger)

  • fix issue when using addPlot with vector.graphic = F in docx. (reported by Gilles Chapron)

  • fix row spanning disappearance when a column was resized. (reported by Mark Danese)

  • Line textures was not handled as documented in GraphicsEngine.h (reported by José Manuel Martínez)

ReporteRs 0.7.9


  • print method for bsdoc objects when R is interactive

  • drop argument reset.dir of writeDoc.bsdoc

  • rotation of pptx shape is now handled

  • FlexTable header row text can be rotated

ReporteRs 0.7.8


  • modify examples for cran submission

ReporteRs 0.7.6


  • addImage now allows wmf and emf image within docx and pptx objects.

  • addHeaderRow has a new argument first to insert the row at on top of header rows.

  • new function list_bookmarks to extract bookmark names in a docx object

  • addImage has a new argument ppi to help defining dimensions of images within documents.


ReporteRs 0.7.5


  • new function text_extract to extract text from a docx object


ReporteRs 0.7.4


  • new print method for FlexTable that display the FlexTable in the default browser or in RStudio viewer

  • improved vanilla.table rendering

  • pot now handles soft returns when \n is used.


ReporteRs 0.7.3


  • minor debug with FlexTable subset (reported by Gilles Chapron).

  • Fix addDocument issue: close embedded file after having read it. (suggested by Olivier Barriere)

ReporteRs 0.7.2


  • nicer tooltip with interactive plots in bsdoc documents. See addPlot.bsdoc.

  • modify examples so that R CMD check --run-donttest does not fail

ReporteRs 0.7.1


  • markdown Title illegitimately detected. See github.

  • PDF issues: table cell padding is now rendered correctly when docx is saved to pdf.


  • embed external docx file into docx object with addDocument function (suggested by Olivier Barriere). See github.

  • allow comma and few other symbols in layout names for Libre Office users. See github.

  • id of the title can be specified with addTitle.bsdoc

  • new function for bsdoc: addTOC. It lets you generate a TOC into a bsdoc document.

ReporteRs 0.7.0


  • markdown handle '_' and protect link and references

ReporteRs 0.6.9


  • add bsdoc, a new object to produce html documents with Bootstrap.


  • debug an issue with POSIXlt data when used in FlexTable (reported by Victor Perrier)

ReporteRs 0.6.8


  • add markdown processing via function addMarkdown.


  • addRScript.pptx debug (line height is now correct).

ReporteRs 0.6.6


  • add shading color for textProperties and parProperties

  • add hyperlink option to pot objects

  • add footnote option to pot objects (for docx and html objects)

ReporteRs 0.6.5


  • ordered and unordered list item. See > ?parProperties and > ?list.settings.

  • addParagraph.pptx has a new argument append to append in an existing shape

ReporteRs 0.6.4


  • increase controls over pptx template

ReporteRs 0.6.3


  • addImage.pptx debug (from 0.6.0).

  • addRScript.pptx debug (from 0.6.0).


  • pptx template

ReporteRs 0.6.2


  • addSection minor debug


  • new function vanilla.table and light.table

  • add an argument runs to function spanFlexTableColumns to span successive columns. (suggested by David Hajage)

ReporteRs 0.6.1


  • new function setFlexTableBackgroundColors enable coloring of cell background of a FlexTable. (suggested by Jean-Francois Collin)

  • work on the documentation of FlexTable and alterFlexTable

  • let addParagraph.docx have no stylename argument when bookmark argument is used. (suggested by G�nter Lutz)


  • Reintroducing in function chprop.cellProperties arguments, border..width and border.*.color for backward compatibility.

  • fixes for bugs related to FlexTable that appeared during java refactoring (setFlexTableBorders).

ReporteRs 0.6.0


  • New function AddSection for docx document. It lets you add horizontal page sections and sections with 2 or more columns.

  • java refactoring.

ReporteRs 0.5.9


  • BorderProperties are now supported when formatting FlexTable

ReporteRs 0.5.8


  • implementation of "[" operator for FlexTable headers and footers modifications (add and format content).

  • add function toc.options for docx object. When list separator used when building the TOC is different from the list separator in your computer's regional settings, the doc cannot be built. toc.options let force the separator (read from the template document used to initialize the docx object)

    ?toc.options.docx (reported by Isabella R. Ghement)

  • as.html now works on pot objects

ReporteRs 0.5.7


  • add doc entry "bookmark".


  • better tootltips

  • in Rmd/example.Rmd, you will find an example of using ReporteRs with knitr.

ReporteRs 0.5.6


  • debug addParagraph.docx into a bookmark with multiple paragraph (reported by Günter Lutz)
  • debug text function in dml graphical devices when symbols '<', '>', '&' where used. (reported by Ted Kwartler and Karen Zalvan)


  • add clipping for lines and polygons in graphical devices (reported by Jean-Francois Collin)

ReporteRs 0.5.5



  • add str and print method for FlexTable

ReporteRs 0.5.4


  • debug text function in Raphael graphical device


  • addRScript implemented for docx, html and pptx

  • addParagraph.pptx now comes with a parProperties argument

  • HTML code is available for FlexTable and plots. See as.html.FlexTable and raphael.html.

  • addParagraph.pptx, addPlot.pptx, addFlexTable.pptx, addImage.pptx gain arguments offx, offy, width and height (default missing) to allow positioning shapes freely on a slide (independently of what is defined in the slide layouts).

ReporteRs 0.5.3



  • FlexTable API is now much more easier to use. Lot of new functions have been added. see ?FlexTable

  • add function setFlexTableWidths to set columns widths in FlexTable (suggested by Goulven Salic)

  • add methods chprop to modify property objects (applies to textProperties, parProperties and cellProperties). Usefull to reduce code.

  • Detection of titles style names in template docx generated by an Simplified Chinese Office version (suggested by Bai Xueyuan)

  • add names to stylenames returned by styles.docx to help identify which stylename corresponds to which Word paragraph style

  • add method dim to objects of class docx and pptx. It returns page dimensions for docx and next free shape dimensions for pptx

ReporteRs 0.5.2


  • compilation with flags -Wformat -Wformat-security (default compiler flags on Ubuntu) was driving to an error. Code changed: usage of fputs instead of fprintf when no formatting is required (reported by Günter Lutz)


  • add function "add.plot.interactivity" for plot interactivity when output is html.

  • Cleaning and reorganization of the C code files

ReporteRs 0.5.1


  • graphical element ids were not correctly incremented in the graphical device drivers driving to an error when opening the docx (reported by Jean-Francois Collin)

ReporteRs 0.5


  • Fixed an issue with lines in pptx graphical device driver (reported by Julio Alejandro Di Rienzo)

  • a java exception was throwed when accents were used in pptx (reported by Julio Alejandro Di Rienzo)

ReporteRs 0.4


  • deleteBookmark and deleteBookmarkNextContent did not return the input document as expected - returned invisible() instead (reported by Günter Lutz)


  • Higher PNG resolution (par res of png is set to 300) in documents(suggested by Goulven Salic)

  • addFlexCellContent is a new function to add formated content in FlexTable objects

ReporteRs 0.3


  • add copyrights in the correct file

  • Package preparation for CRAN submission

ReporteRs 0.2


  • Title text can now have accents and '&' and '>' and '<'. (reported by Jean-Francois Collin)

  • namespace of java codes have been changed to 'org.lysis'. ReporteRs can coexists with R2DOCX now (reported by Jean-Francois Collin)

  • got rid of java rendersnake for html generation


  • The default Word template has now separate numbering index for styles rPlotLegend and rTableLegend

  • bookmark are no more deleted, replacements over the same docx or pptx is now possible

  • help at


  • FlexTable : see ?FlexTable A new object and its methods to generate complex tables

ReporteRs 0.1


  • argument row.names in addTable (suggested by Rees Morrison)

  • argument underlined in textProperties (suggested by Rees Morrison)

Reference manual

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


0.8.10 by ORPHANED, 3 months ago

Report a bug at

Browse source code at

Authors: David Gohel [aut, cre]

Documentation:   PDF Manual  

Task views: Reproducible Research

GPL-3 license

Imports grDevices, rJava, utils, rvg, xml2, gdtools, png, R.utils, knitr, shiny, htmltools

Depends on ReporteRsjars

Suggests ggplot2, jpeg, bmp, testthat, magrittr, rmarkdown

System requirements: java (>= 6)

Imported by Fgmutils, RtutoR, bfw, clickR, microplot, thinkr.

Depended on by rtable.

Suggested by Mediana, WordR, bmlm.

See at CRAN