MyNixOS website logo
Description

Enhanced 'R Markdown' Format for 'Word' and 'PowerPoint'.

Allows production of 'Microsoft' corporate documents from 'R Markdown' by reusing formatting defined in 'Microsoft Word' documents. You can reuse table styles, list styles but also add column sections, landscape oriented pages. Table and image captions as well as cross-references are transformed into 'Microsoft Word' fields, allowing documents edition and merging without issue with references; the syntax conforms to the 'bookdown' cross-reference definition. Objects generated by the 'officer' package are also supported in the 'knitr' chunks. 'Microsoft PowerPoint' presentations also benefit from this as well as the ability to produce editable vector graphics in 'PowerPoint' and also to define placeholder where content is to be added.

R buildstatus version cranlogs Active

{officedown} is bringing some officer features into R markdown documents.

Overview

Word

The package facilitates the formatting of Microsoft Word documents produced by R Markdown documents by providing a range of features:

officedown logo

  • Compatibility with the functions of the package officer for the production of “runs” and “blocks” of content (text formatting, landscape mode, tables of contents, etc.).

    You can add a column break in a two-column section, you can easily color a chunk of text, you can add tables of contents at any place in the document and also add a list of figures or list of tables.

  • Ability to use the table styles and list styles defined in the “reference_docx” which serves as a template for the pandoc document.

    With rmarkdown, you can reuse all paragraph styles. With {officedown}, you can also reuse table and list styles. These features are based on the use of Word templates (reference_docx). It is recommended to learn how “Word styles” work for paragraphs, tables and lists if you never really used Word styles.

    These styles are to be defined in a Word document that serves as a template. You must first create a Word document (or edit an existing Word document), adjust the styles and save it. This document which serves as a vehicle for the defined styles will be used by R Markdown, the argument reference_docx must be filled in with the file path.

  • The replacement of captions (tables, figures and standard identifiers) by captions containing a Word bookmark that can be used for cross-referencing. Also the replacement of cross-references by cross-references using fields calculated by Word. The syntax conforms to the bookdown cross-reference definition.

    The package transforms some specific knitr codes into references calculated by Word, it applies to:

    • cross-references with bookdown syntax
    • table and image captions
    • title identifiers

    It is then easy to copy and paste the content into another document without losing the reference numbers. Captions are also auto-numbered by Word.

  • Full support for flextable output, including with outputs containing images and links.

    The package enable knitting flextable outputs with images or plots in cells without using {officer}. Insertion of images in {flextable} is not supported with rmarkdown::word_document but is possible by using officedown::rdocx_document.

PowerPoint

The package also enhances PowerPoint productions with R Markdown by providing a mechanism for placing results according to the slide template contained in the PowerPoint document used as “reference_doc”. It becomes easy to add several contents in the same slide.

The package also offers the possibility to transform your graphic instructions into editable vector graphics (with the rvg package) by simply wrapping your call into a call to function dml.

Resources

The help pages are in a bookdown located at:

https://ardata-fr.github.io/officeverse/

Manuals are available at:

https://davidgohel.github.io/officedown/.

Installation

You can install {officedown} from github with:

remotes::install_github("davidgohel/officedown")

Supported formats require some minimum pandoc versions:

R Markdown outputpandoc version
Microsoft Word>= 2.0
Microsoft PowerPoint>= 2.4

Getting started

rdocx_document

use RStudio Menu to create a document from {officedown} template.

It creates an R markdown document, parameter output is set to officedown::rdocx_document. Note that package {officedown} need to be loaded in the Rmd.

Word Features illustration

A bookdown is available in the package and can be used as a demo.

dir <- system.file(package = "officedown", "examples", "bookdown")
file.copy(dir, getwd(), recursive = TRUE, overwrite = TRUE)
#> [1] TRUE
# rmarkdown::render_site("bookdown")
fs::dir_tree("bookdown", recurse = TRUE)
#> bookdown
#> ├── 01-intro.Rmd
#> ├── 02-toc.Rmd
#> ├── 03-tables.Rmd
#> ├── 04-sections.Rmd
#> ├── 05-plots.Rmd
#> ├── _bookdown.yml
#> ├── _output.yml
#> ├── bookdown.Rproj
#> ├── index.Rmd
#> └── template.docx

You should see the following document:

Metadata

Version

0.3.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows