Giter Site home page Giter Site logo

officedown's Introduction

Travis build status AppVeyor build status lifecycle CRAN status

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-04-30"
author: "David Gohel"
title: "Document title"
output: 
  officedown::rdocx_document
---


```r
library(officedown)
```

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
This text will be followed by a break page.<!---CHUNK_PAGEBREAK--->

`r add_paragraph_settings(align='center', paddings = list(t= 120, b= 20))`
This paragraph will be centered and wil have a 120 pts top padding and 20 bottom padding.
Text can be styles: <!---CHUNK_TEXT{str: 'officedown', color: 'orange'}---> is really cool.

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
The following will be transformed as a table of content:

<!---BLOCK_TOC--->

And the following will pour the content of an external docx file into the produced document:

<!---BLOCK_POUR_DOCX{docx_file:'path/to/docx'}--->

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
The following will be in a separated section with landscape orientation

<!---BLOCK_LANDSCAPE_START--->

Blah blah blah.

<!---BLOCK_LANDSCAPE_STOP--->
  • section with columns
Tag name R function Has args
BLOCK_MULTICOL_START block_section_continuous no
BLOCK_MULTICOL_STOP block_section_columns yes
The following will be in a separated section with 2 columns:

<!---BLOCK_MULTICOL_START--->

Blah blah blah on column 1.

<!---CHUNK_COLUMNBREAK--->
Blah blah blah on column 2.


<!---BLOCK_MULTICOL_STOP{widths: [3,3], space: 0.2, sep: true}--->

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

officedown's People

Contributors

davidgohel avatar krlmlr avatar noamross avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.