Skip to content

Commit dfe1a6f

Browse files
committed
enable website build
1 parent 8267680 commit dfe1a6f

2 files changed

Lines changed: 46 additions & 7 deletions

File tree

_pkgdown.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ reference:
8888
- "rtf_footnote"
8989
- "rtf_source"
9090
- "rtf_encode"
91+
- title: Write to File
92+
contents:
9193
- "write_rtf"
94+
- "write_docx"
95+
- "write_html"
96+
- title: Assemble Documents
97+
contents:
9298
- "assemble_rtf"
9399
- "assemble_docx"
94100
- title: RTF Figure

vignettes/rtf-convert-format.Rmd

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,48 @@ r2rtf:::rtf_convert_format(
2222

2323
## Overview
2424

25-
`r2rtf` had an experimental internal function `r2rtf:::rtf_convert_format` to
26-
convert RTF format to PDF, DOCX, or HTML.
27-
This feature requires LibreOffice >= 7.1 and was only
28-
tested in a Linux environment.
25+
`r2rtf` provides multiple ways to convert RTF format to other formats including PDF, DOCX, and HTML:
2926

30-
By default, `r2rtf:::rtf_convert_format` convert RTF file to PDF format.
27+
1. **User-facing functions**: `write_docx()` and `write_html()` - Exported functions for converting RTF encoding to DOCX or HTML
28+
2. **Internal function**: `r2rtf:::rtf_convert_format()` - Lower-level function for batch conversion of RTF files
29+
30+
All conversion features require LibreOffice >= 7.1 and currently support Unix/Linux/macOS systems only.
31+
32+
## Using write_docx() and write_html()
33+
34+
The `write_docx()` and `write_html()` functions provide a simple interface to convert RTF encoding directly to DOCX or HTML formats.
35+
36+
### Write DOCX
37+
38+
```{r, eval = FALSE}
39+
# Create RTF encoding
40+
rtf <- head(iris) |>
41+
rtf_body() |>
42+
rtf_encode()
43+
44+
# Convert to DOCX
45+
write_docx(rtf, "output/table.docx")
46+
```
47+
48+
### Write HTML
49+
50+
```{r, eval = FALSE}
51+
# Create RTF encoding
52+
rtf <- head(cars) |>
53+
rtf_body() |>
54+
rtf_encode()
55+
56+
# Convert to HTML
57+
write_html(rtf, "output/table.html")
58+
```
59+
## Using rtf_convert_format() (Advanced)
60+
61+
The internal `r2rtf:::rtf_convert_format()` function provides more control for batch processing of existing RTF files.
62+
63+
By default, `r2rtf:::rtf_convert_format` converts RTF files to PDF format.
3164
The PDF file will be saved in the same folder with same file name by default.
3265

33-
In example below, `ae_example.pdf` will be created in the same folder.
66+
In the example below, `ae_example.pdf` will be created in the same folder.
3467

3568
```{r, eval = FALSE}
3669
r2rtf:::rtf_convert_format(input = "rtf/ae_example.rtf")
@@ -42,7 +75,7 @@ r2rtf:::rtf_convert_format(input = "rtf/ae_example.rtf")
4275
r2rtf:::rtf_convert_format(input = list.files("rtf", pattern = "*.rtf"))
4376
```
4477

45-
- The `format` argument allow use to specify output format as `pdf`, `docx`, or `html`.
78+
- The `format` argument allows you to specify output format as `pdf`, `docx`, or `html`.
4679

4780
```{r, eval = FALSE}
4881
r2rtf:::rtf_convert_format(input = "rtf/ae_example.rtf", format = "html")

0 commit comments

Comments
 (0)