-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
87 lines (59 loc) · 4.24 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# officerExtras <a href="https://elipousson.github.io/officerExtras/"><img src="man/figures/logo.png" align="right" height="108" alt="officerExtras website" /></a>
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![Codecov test coverage](https://codecov.io/gh/elipousson/officerExtras/branch/main/graph/badge.svg)](https://app.codecov.io/gh/elipousson/officerExtras?branch=main)
<!-- badges: end -->
The goal of officerExtras is to provide helper and convenience functions for the [{officer}](https://github.com/davidgohel/officer) package.
## Installation
You can install the development version of officerExtras like so:
``` r
pak::pkg_install("elipousson/officerExtras")
```
## Usage
The officerExtras package provides a variety of helper functions to simplify the process of working with officer. For example, a single `read_officer()` function works with docx, pptx, or xlsx files:
```{r read_officer}
library(officerExtras)
docx <- read_officer(filename = "example.docx", path = system.file("doc_examples", package = "officer"))
pptx <- read_officer(filename = "example.pptx", path = system.file("doc_examples", package = "officer"))
```
officer uses a print method to save rdocx, rpptx, or rxlsx objects back to files. officerExtras provides a `write_officer()` with that adds the option to pass a filename and path separately and pass document properties to `officer::doc_properties()`.
```{r write_officer}
withr::with_tempdir({
write_officer(docx, "write-example.docx", modified_by = "officerExtras", title = "Document Title set by doc_properties", subject = "Microsoft Word, R")
example_docx <- read_officer("write-example.docx")
officer::doc_properties(example_docx)
})
```
The package also wraps useful functions from a few other packages. `convert_docx()` uses `rmarkdown::pandoc_convert()` to convert a rdocx object or a Word document to any other pandoc supported output format:
```{r convert_docx}
convert_docx(docx, to = "markdown")
```
## Related projects
There are a number of related projects for extending officer or working with [OOXML](https://en.wikipedia.org/wiki/Office_Open_XML) in R and other languages.
### Extending officer
- [gto](https://github.com/GSK-Biostatistics/gto): allow users to insert gt tables into officeverse.
- [onbrand](https://github.com/john-harrold/onbrand): A R package to provide a systematic method to script support for different Word of PowerPoint templates.
- [officerWinTools](https://github.com/joshmire/officerWinTools): A R package to complement the officer package when using Microsoft Office in a Windows environment.
### Working with Microsoft Office documents with R
- [docxtractr](https://github.com/hrbrmstr/docxtractr): Extract Tables from Microsoft Word Documents with R
- [stylex](https://github.com/niszet/stylex): A R package to help update docx style files.
- [deef](https://github.com/prcleary/deef): Data extractor scripts for electronic forms, compatible with Microsoft Word files.
### Other tools for working with Microsoft Office documents
- [python-docx](https://github.com/python-openxml/python-docx):Create and modify Word documents with Python
- [Docx-templates](https://github.com/guigrpa/docx-templates): Template-based docx report creation for both Node and the browser
- [docx](https://github.com/dolanmiu/docx): Easily generate and modify .docx files with JS/TS. Works for Node and on the Browser.
- [docxtemplater](https://github.com/open-xml-templating/docxtemplater): Generate docx, pptx, and xlsx from templates (Word, Powerpoint and Excel documents), from Node.js, the Browser and the command line