officedownis bringing some officer features into R markdown documents.
- 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.
- 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 type | Tag name | R function | Has args |
|---|---|---|---|
| chunk | CHUNK_PAGEBREAK | chunk_page_break | no |
| chunk | CHUNK_TEXT | chunk_styled_text | yes |
| chunk | CHUNK_TEXT_STYLE | chunk_text_stylenamed | yes |
| chunk | CHUNK_COLUMNBREAK | chunk_column_break | no |
| chunk | add_paragraph_settings | yes |
Blocks
Blocks are to be used as a paragraph in an R markdown document.
| Output type | Tag name | R function | Has args |
|---|---|---|---|
| block | BLOCK_TOC | block_toc | yes |
| block | BLOCK_POUR_DOCX | block_pour_docx | yes |
Sections blocks
Section blocks are also blocks but they need to be used in pairs:
- landscape orientation
| Tag name | R function | Has args |
|---|---|---|
| BLOCK_LANDSCAPE_START | block_section_continuous | no |
| BLOCK_LANDSCAPE_STOP | block_section_landscape | no |
- section with columns
| Tag name | R function | Has args |
|---|---|---|
| BLOCK_MULTICOL_START | block_section_continuous | no |
| BLOCK_MULTICOL_STOP | block_section_columns | yes |
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 output | pandoc version | comment |
|---|---|---|
| Microsoft Word | >= 2.0 | require a recent RStudio (> june 2018) |
| Microsoft PowerPoint | >= 2.4 | require pandoc installation |