officer is an R package for manipulating Word (.docx) and PowerPoint (*.pptx) documents.
Questions tagged [officer]
413 questions
2
votes
1 answer
Writing word documents with the officer package: How to combine several rdocx objects?
I have several rdocx data objects created with the officer package in R. I want to combine these rdocx objects into only one rdocx object.
Consider the following example:
library("officer")
# Create two rdocx data objects
doc1 <- read_docx()
doc1…

Joachim Schork
- 2,025
- 3
- 25
- 48
2
votes
0 answers
When using flextable in R, how to add a vertical bar between cells if both used in a merge
I am trying to use two variables to group data: Country and State_Province.
I want to use 'flextable' in R to do this and I also want the two variables to be next to each other in the resulting table separated by a vertical bar.
However using…

Lionel Duarte
- 121
- 6
2
votes
0 answers
Format text with ph_with_text in officer
I'm adding text to a placeholder in a PP slide with officer. How do I format the text inside the ph_with_text() function of the officer library? It ignores the style command from the fptext function.

scdavis50
- 111
- 1
- 5
2
votes
0 answers
Change font size and style in officeR's body_add_table() function
I am trying to change the font size in a table within the officer's body_add_table() function, with no success. How can I do this?
I am using the following code:
body_add_table(my_doc, value = tab02, style = "table_template", font.size = 10)

Bruno Guarita
- 767
- 10
- 21
2
votes
0 answers
Change font size and style in officeR body_add_table() function
I am trying to change the font size and style in a table within the officer package. Does anyone knows how to do it?
body_add_table(my_doc, value = tab02, style = "table_template", font.size = 10)

Bruno Guarita
- 767
- 10
- 21
2
votes
0 answers
Convert flextable to grobTable
is there any way to convert a regulartable or a flextable to a graphical object, maybe to a grobTable, so that it can be used later by the gridExtra package (eg. with the method grob.arrange) to arrange more elements in a slide easier?
grid.arrange…

Popescu Gabriel
- 137
- 6
2
votes
0 answers
officer chart removing border around chart
Does anyone know how I can remove the border around an ms chart object when I insert it in a word document using office R?
Here is the code to create the chart:
library(mscharts);library(officer)
test_data <- data.frame("Var1" = c(2,4,6,8),…

clairekelley
- 427
- 2
- 4
- 11
2
votes
0 answers
How can I add a table to the header of a Word document using the officer package in R?
I'm trying to switch from ReporteRs to officer. When using ReporteRs, I was able to add a FlexTable to the header by using a bookmark that I set up in a Word document template (I placed a bookmark in the header of the template called…

Sam Dickson
- 5,082
- 1
- 27
- 45
2
votes
0 answers
underline text when writing a word document using officer package in R
I am trying to create a .docx file in R using officeR package, and I want a piece of text to be underlined. Though fp_text offers the arguments to underline text, it does not seem to work. Any help is appreciated!
fpt = fp_text(color = "red", bold =…

sgt
- 21
- 2
2
votes
1 answer
Load theme from existing chart
Using officeR and mschart packages I'm trying to match the theme of the company presentation. Is there a way to obtain the chart theme (for a further use in mschart) from an existing chart in pptx?

sfr
- 43
- 5
2
votes
0 answers
How to get ReporteRs to work after installing officer
I've been using the ReporteRs package to generate MS Word documents from R. Due to some Java problems, I tried the officer package as well. Ever since I installed officer, I am unable to load the ReporteRs package:
library(ReporteRs)
Loading…

BjaRule
- 171
- 5
1
vote
0 answers
Is there anyway to replace a bookmark with a space using the body_replace_text_at_bkm from the officer R package?
I'm trying to use officer::body_replace_text_at_bkm to replace a bookmark in a Word Document with an empty space.
I have a Word document template with a bookmark like the one below.
I used the code below to replace the "space" bookmark with an…

William Spagnola
- 51
- 4
1
vote
1 answer
R: Automate generating word documents based on dataframe
I am trying to find a way to automate generating word documents based on a data frame containing addresses that I would like inserted into separate word documents:
`DF <- data.frame(Company=c('Alpha','Beta', 'Gamma'),
Name= c('John…

CuRious Coder
- 27
- 4
1
vote
0 answers
Using R to mail merge a word document with text and image placeholders
In Word, you can prepare your doc with a Text_placeholder and Image_placeholder and effectively do a mail merge which replaces the text (as in all mail merges) but also iteratively embeds images at the image placeholder.
Is there a way to…

Ndharwood
- 123
- 3
- 11
1
vote
1 answer
How to make a table take up almost the entire width of a page with the officer package?
I've been trying for a while to make the table take up almost the entire width of the Word page, but I haven't been successful. I've used the functions:
table_width
width
fit_to_width
without success.
I've been trying for a while to make the table…

pleemore
- 21
- 2