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.
ReporteRs will be maintained but will not evolve anymore. It has been rewritten with no java dependency:
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:
FlexTableobjects let you format any complex table.
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" )
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.
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
rJava installation with the following code, you should get
your java version in a string:
require(rJava).jinit()#>  0.jcall('java.lang.System','S','getProperty','java.version')#>  "1.8.0_31"
The help pages are located at https://davidgohel.github.io/ReporteRs/.
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
ReporteRs has its own tag Stackoverflow
link! I usually
read them and answer when possible.
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.
empty_templateused to clear template content.
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'.
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.
add CodeBlock for vertabim output
add pot_img function to add inline images to pot objects
There are major corrections in graphic devices with UTF-8 text and text positions. (reported by John Ehrlinger)
fix par.properties 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)
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
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.
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.
minor debug with FlexTable subset (reported by Gilles Chapron).
Fix addDocument issue: close embedded file after having read it. (suggested by Olivier Barriere)
nicer tooltip with interactive plots in bsdoc documents. See addPlot.bsdoc.
modify examples so that R CMD check --run-donttest does not fail
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.
add shading color for textProperties and parProperties
add hyperlink option to pot objects
add footnote option to pot objects (for docx and html objects)
ordered and unordered list item. See > ?parProperties and > ?list.settings.
addParagraph.pptx has a new argument append to append in an existing shape
addImage.pptx debug (from 0.6.0).
addRScript.pptx debug (from 0.6.0).
new function vanilla.table and light.table
add an argument runs to function spanFlexTableColumns to span successive columns. (suggested by David Hajage)
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..style, border..width and border.*.color for backward compatibility.
fixes for bugs related to FlexTable that appeared during java refactoring (setFlexTableBorders).
New function AddSection for docx document. It lets you add horizontal page sections and sections with 2 or more columns.
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
add doc entry "bookmark".
in Rmd/example.Rmd, you will find an example of using ReporteRs with knitr.
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).
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
add function "add.plot.interactivity" for plot interactivity when output is html.
Cleaning and reorganization of the C code files
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)
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
add copyrights in the correct file
Package preparation for CRAN submission
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
argument row.names in addTable (suggested by Rees Morrison)
argument underlined in textProperties (suggested by Rees Morrison)