Learn R Programming

⚠️There's a newer version (0.3.3) of this package.Take me there.

officedown is bringing some officer features into R markdown documents.

  1. Pimp your R markdown documents… to produce Word documents.

The package is to be used when you want to use R Markdown documents to produce Microsoft Word documents but also want options for landscape orientation, with narrow margins, with formatted text, when some paragraphs have to be centered.

  1. Add vector graphics into your PowerPoint document. This feature let’s you add rvg in you presentation.

Usage

use RStudio Menu to create a document from officedown template.

It will create an R markdown document, parameter output is to be set to officedown::rdocx_document. Also package officedown need to be loaded.

---
date: "2019-11-12"
author: "David Gohel"
title: "Document title"
output: 
  officedown::rdocx_document
---


```r
library(officedown)
#> Warning: S3 method 'print.dml' was declared in NAMESPACE but not found
```

Tags have been made to make less verbose and easier use. Some are expected parameters (i.e. CHUNK_TEXT, BLOCK_MULTICOL_STOP). These parameters need to be defined as inline yaml.

Chunks

Chunks are to be used in a paragraph in an R markdown document.

Output typeTag nameR functionHas args
chunkCHUNK_PAGEBREAKchunk_page_breakno
chunkCHUNK_TEXTchunk_styled_textyes
chunkCHUNK_TEXT_STYLEchunk_text_stylenamedyes
chunkCHUNK_COLUMNBREAKchunk_column_breakno
chunkadd_paragraph_settingsyes

Blocks

Blocks are to be used as a paragraph in an R markdown document.

Output typeTag nameR functionHas args
blockBLOCK_TOCblock_tocyes
blockBLOCK_POUR_DOCXblock_pour_docxyes

Sections blocks

Section blocks are also blocks but they need to be used in pairs:

  • landscape orientation
Tag nameR functionHas args
BLOCK_LANDSCAPE_STARTblock_section_continuousno
BLOCK_LANDSCAPE_STOPblock_section_landscapeno
  • section with columns
Tag nameR functionHas args
BLOCK_MULTICOL_STARTblock_section_continuousno
BLOCK_MULTICOL_STOPblock_section_columnsyes

Working with officedown

Installation

You can install officedown from github with:

# install.packages("devtools")
devtools::install_github("davidgohel/officedown")

Supported formats require some minimum pandoc versions:

R Markdown outputpandoc versioncomment
Microsoft Word>= 2.0require a recent RStudio (> june 2018)
Microsoft PowerPoint>= 2.4require pandoc installation

Copy Link

Version

Install

install.packages('officedown')

Monthly Downloads

4,675

Version

0.0.5.003

License

MIT + file LICENSE

Maintainer

David Gohel

Last Published

March 18th, 2025

Functions in officedown (0.0.5.003)

sections

section
chunk_styled_text

styled text
chunk_seqfield

add a seqfield
chunk_page_break

add a page break
get_reference_pptx

Get the document being used as a template
add_paragraph_settings

add settings for a paragraph
rpptx_document

Convert to an MS PowerPoint document
knit_print.dml

Render a plot as a Powerpint DrawingML object
rdocx_document

Convert to an MS Word document
block_pour_docx

pour the content of a docx file
block_toc

add a table of content
chunk_text_stylenamed

add text and associate it with a character style name.
chunk_column_break

add a column break