Access and manipulate 'Microsoft Word', 'Microsoft PowerPoint', 'Microsoft Excel' and 'RTF' documents from R. The package focuses on tabular and graphical reporting from R; it also provides two functions that let users get document content into data objects. A set of functions lets add and remove images, tables and paragraphs of text in new or existing documents. The package does not require any installation of Microsoft products to be able to write Microsoft files.
Make corporate reporting with minimum hassle
The officer package lets R users manipulate Word (.docx) and
PowerPoint (*.pptx) documents. In short, one can add images, tables
and text into documents from R. An initial document can be provided;
contents, styles and properties of the original document will then be
available. It also supports the writing of ‘RTF’ documents and basic
manipulation of Excel (‘.xlsx’) workbooks.
The help pages are in a bookdown located at:
https://ardata-fr.github.io/officeverse/
Manuals are available at:
https://davidgohel.github.io/officer/.
The read_docx() function will read an initial Word document (an empty
one by default) and lets you modify its content later.
The package provides functions to add R outputs into a Word document:
File generation is performed with the print function.
The function docx_summary() reads and imports content of a Word
document into a data.frame. The function handles paragraphs, tables and
section breaks. The function docx_comments() reads comments of a Word
document and organise the results into a data.frame.
The function read_pptx() will read an initial PowerPoint document (an
empty one by default) and let you modify its content later.
The package provides functions to add R outputs into existing or new PowerPoint slides:
In a PowerPoint document, one can set a slide as selected and reach a particular shape (and remove it or add text).
File generation is performed with the print() function.
The pptx_summary() function reads and imports content of a PowerPoint
document into a data.frame. The function handles paragraphs, tables and
images.
flextableThe package flextable brings a full API to produce nice tables and use them with packages officer and rmarkdown.
rvgThe package rvg brings an API to
produce nice vector graphics that can be embedded in PowerPoint
documents or Excel workbooks with officer.
mschartThe package mschart combined
with officer can produce native office charts in PowerPoint and Word
documents.
officedownThe package officedown facilitates the formatting of Microsoft Word documents produced by R Markdown documents.
You can get the development version from GitHub:
devtools::install_github("davidgohel/officer")
Or the latest version on CRAN:
install.packages("officer")
If you have questions about how to use the package, visit Stack
Overflow’s officer tag and post your question there. I usually read
them and answer when possible.
Please read CONTRIBUTING.md before opening an issue or a discussion. In short:
sessionInfo();officer tag, or
Discussions;