I am new to using Rmarkdown and officer/officedown, so maybe there is an easy fix for this, but I'm at a loss. I'm trying to create a Word document for reports using officedown/officer so that I can have greater control over the look of text and such. I kept getting odd results with my own code so tried to basically just copy/paste a very simple example from https://ardata-fr.github.io/officeverse/formatting-properties.html (the example from section 7.1). Below is the code that I input into Rmarkdown (with appropriate --- and ``` {r} added where needed). And the further down is the result I received minus the typical warnings that I'm not concerned about."
title: "Untitled"
author: "author"
date: "7/21/2021"
output: officedown::rdocx_document
knitr::opts_chunk$set(echo = TRUE)
library("officedown")
library("officer")
library("dplyr")
properties1 <- fp_text(color = "#006699", bold = TRUE, font.size = 50)
properties2 <- fp_text(color = "#C32900", bold = TRUE, font.size = 50)
ftext1 <- ftext("hello ", properties1)
ftext2 <- ftext("World", properties2)
paragraph <- fpar(ftext1, ftext2)
read_docx() %>%
body_add_fpar(paragraph) %>% print()
The following is the output I received in the word document, not the properly formatted text from the example. This is very very similar to what I was getting when using my own code.
Any idea how to make this look right? Thanks!
## rdocx document with 2 element(s)
##
## * styles:
## Normal heading 1 heading 2
## "paragraph" "paragraph" "paragraph"
## heading 3 Default Paragraph Font Normal Table
## "paragraph" "character" "table"
## No List strong centered
## "numbering" "character" "paragraph"
## table_template Light List Accent 2 Titre 1 Car
## "table" "table" "character"
## Titre 2 Car Titre 3 Car Image Caption
## "character" "character" "paragraph"
## Table Caption Table Professional toc 1
## "paragraph" "table" "paragraph"
## toc 2 Balloon Text Texte de bulles Car
## "paragraph" "paragraph" "character"
## reference_id graphic title table title
## "character" "paragraph" "paragraph"
##
## * Content at cursor location:
## level num_id text style_name content_type
## 1 NA NA hello World NA paragraph