-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
reporter-rtf.Rmd
61 lines (47 loc) · 1.58 KB
/
reporter-rtf.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
---
title: "Example 9: RTF, PDF, HTML, and DOCX"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Example 9: RTF, PDF, HTML, and DOCX}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
### Output to RTF, PDF, HTML, and DOCX
The **reporter** package supports five types of output: TXT, RTF, PDF, HTML,
and DOCX.
The package produces TXT reports by default. If you want to produce RTF, PDF,
HTML, or DOCX output, simply change the output type. Below is a portion
of the Iris data listing from above, but the `output_type`
is now set to DOCX.
```{r eval=FALSE, echo=TRUE}
library(reporter)
# Create temporary path
tmp <- file.path(tempdir(), "example9.docx")
# Read in prepared data
df <- iris[1:25, ]
# Create table
tbl <- create_table(df, borders = "bottom")
# Create report and add content
rpt <- create_report(tmp, output_type = "DOCX", orientation = "portrait",
font = "Times", font_size = 12) %>%
set_margins(top = 1, bottom = 1) %>%
page_header(left = "Client: 1-800-FLOWERS", right = "Study: Iris") %>%
titles("Listing 1.0", "Iris Data Listing") %>%
add_content(tbl) %>%
footnotes("* Bulletin of the American Iris Society, 1935") %>%
page_footer(left = Sys.time(),
center = "Confidential",
right = "Page [pg] of [tpg]")
# Write out report
write_report(rpt)
# View report
# file.show(tmp)
```
<img src="../man/images/rtf.png"/>
Next: [Example 10: Fonts and Borders](reporter-fonts.html)