Questions tagged [officer]

officer is an R package for manipulating Word (.docx) and PowerPoint (*.pptx) documents.

413 questions
0
votes
1 answer

Why the Officer package write to doc reverse in r?

Why Officer write to doc reverse? I face that after i updated my R 4.0 to 4.2. This is my code: main.doc <-read_docx() body_add_par(main.doc," first ") body_add_par(main.doc," second " ) body_add_par(main.doc," third…
0
votes
0 answers

flextable when saved as pdf using officer prints small ticks

See my code library(flextable) library(officer) library(magrittr) my_doc <- read_docx() tb = head(iris, 4) tb <- flextable(tb) tb <- width(tb, width = 1.1) my_doc <- my_doc %>% body_add_flextable(tb, align = 'left') print(my_doc, target =…
Arkadi w
  • 129
  • 22
0
votes
0 answers

Retrieve docx footnotes with officer package

I have read a docx file into R using officer package. Here is the code I used: library(officer) files = list.files() doc <- read_docx(files[1]) content = docx_summary(doc) The resulting dataframe contains all paragraphs, but not the text in the…
0
votes
1 answer

R/Officer/MsChart export to Powerpoint: How to set the Interval between labels for a Barchart

I currently Export e.g. a Barchart with R to a Powerpoint-Presentation using the officer- and mschart-package. I mostly could achive everything I wanted. But if I have a huge data.frame like this (minimal.pptx is just a pptx with one empty…
daily
  • 215
  • 1
  • 12
0
votes
0 answers

read docx() in R appears to be checking the boxes "Different First Page" and "Different Odd & Even Pages" in Word once the document is printed

Pretty simple question here, but I can't find any resources as to why this is happening. I am using the officer package in R to automate the replacement of some text at bookmarks in a large template file. However, when the document is printed out…
KGriff
  • 1
  • 1
0
votes
1 answer

Why the table of contents created with officedown::rdocx_document does not return the section numbers while using a reference_docx file?

Using Rmarkdown, on Rstudio, in order to create a word document ; I tried to create a table of content at the second page of my document. I success using officedown package created by @DavidGohel. However I use a style.docx file as basic template to…
VincentP
  • 89
  • 10
0
votes
0 answers

With the officer package is there a way to loop in a list of mp4 files into a *.docx file?

I need to import a random number of mp4 files into k *.docx patient profiles. I set up the mp4 files as a list, subsetted the list for the desired mp4 files, extracted file name information, and created a for loop to iterate over each…
stat12000
  • 1
  • 1
0
votes
0 answers

Using officer, how do I merge all Word documents in a given directory together

I'm trying to merge all word documents in a given directory together using the officer library in R. I can't quite figure out how to do this, though. Here's my attempt # Directory where your .docx files are located dir <- "../../Word_Docs" # Get a…
Parseltongue
  • 11,157
  • 30
  • 95
  • 160
0
votes
1 answer

Alternate portrait and landscape sections using officer package in R

I would like to make a .pdf report that alternates between portrait (for text) and landscape (for large figures) sections. I use the officer package in R which generates a .docx, that I can convert into .pdf using Word or LibreOffice. I made some…
0
votes
0 answers

Is there a way to test how many slides are in a PP document or template, using R / officer?

I'm building a PowerPoint using R and the terrific officer package. In order to jump back and forth within the presentation (and to the end), does anyone know if there's a function testing how many slides are in the presentation? This would be…
PMaier
  • 592
  • 7
  • 19
0
votes
1 answer

Change background color of a text in word document

Using officer package I would like to change the background colour of a given text say from yellow to green. Here is the colored text and the desired output. I have used body_replace_all_text function in officer as shown below but not yielding the…
Maurice
  • 1
  • 1
0
votes
1 answer

R officer constructing set_header_labels lists of column names and replacements

The officer set_header_labels function assigns a name to print replacing the column name, like this. ft <- set_header_labels(ft, values = list( Sepal.Length = "Sepal length", Sepal.Width = "Sepal width", Petal.Length = "Petal length", Petal.Width =…
JerryN
  • 2,356
  • 1
  • 15
  • 49
0
votes
0 answers

Editing ppt table cell text using R (officer)

Is there a way (maybe using some combination of the ph functions) to edit the text of a table in-place, or delete the table and replace it with an exact copy containing updated data? The table needs very distinct and specific dimension formatting,…
0
votes
0 answers

How do you access or create a bookmark that is in the header so you can use headers_replace_img_at_bkm for the officer library?

I am using the officer library so I can use R to create a Microsoft word document. I am trying to user the headers_replace_img_at_bkm() func to do put our company logo in the header. I need a bookmark in the header so I can use the above script but…
Krich
  • 1
0
votes
0 answers

Replacing keyword in word.docx-file header by officer R package

I cannot access my code via phone (laptop out of order)... I have a basic question: I have a word.docx template where I want to replace a keyword in the header by a new word. Is "headers_replace_all_text()" command the one I should go…
Nadiine El Nino
  • 339
  • 1
  • 6