Questions tagged [officer]

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

413 questions
0
votes
0 answers

How to write a reproducible as_chunk command in flextable R

While in the process to create a flextable in R, I'am unable to write a reproducible quote for a section. This table will be updated every month, therefore adding a new column. To make this reproducible most of my code is in the form on column…
0
votes
0 answers

How do I center a plot on a page with the officer package in R?

According to the documentation located at the link at the bottom of this post, I can center a ggplot on a rdocx page: library(ggplot2) gg <- ggplot(data = iris, aes(Sepal.Length, Petal.Length)) + geom_point() doc_section_1 <-…
Aegis
  • 145
  • 10
0
votes
0 answers

Rendering and outputing a .docx file in r shiny

The prior MS Word format, i.e, .doc, can easily be displayed in as shiny output using the htmltools::htmltemplate function. Not so, it seems, with .docx files, since they are xml. I've been trying to use the officer package which can read .docx…
0
votes
1 answer

How to set the cursor in the beginning of the page with r package officer?

I'm inserting several paragraphs in a word document and the space between paragraphs must be two empty lines. As predict, sometimes one or two paragraphs are positioned at the beginning of a page. In these cases, I need to remove these empty…
0
votes
0 answers

Reading the body text of an rdocx object with OfficeR

I am trying to read the body of a .docx file with the officer package and I am running into an error: library(officer) docx1 <- system.file(package = "officer", "template.docx") content <- docx_summary(docx1) Error in x$doc_obj : $ operator is…
0
votes
0 answers

How to add multiple numbered lists to a Word document using Officer

I am trying to create more than one numbered list in a Word document using the following script: doc_1 <- read_docx() bl1 <- block_list( fpar(ftext("hello", shortcuts$fp_bold(color = "red"))), body_add_par(doc_1, "Item 1", style = "List…
shbshk
  • 72
  • 5
0
votes
0 answers

office in R vs 0.6.2 not able to open Word in Window 11 Office 365

I am new to officeR and I was able to learn it just a few hours. I am running R (R 4.3.0 GUI 1.79 Big Sur Intel build (8225)) on an Apple macOS Big Sur version 11.7.6 and I wrote a small Word document, 4 pages with images, tables, and graphs. I then…
Kirk
  • 1
  • 1
0
votes
0 answers

Add an image in a specific position in the Word document through R quarto

I am working on a script (r.qmd) that outputs into a Word document. I was hopping to place an image before my title. I'll show an example below: (Note that the location is before the main text, it is placed outside the main text margins). Problem…
Bileobio
  • 121
  • 8
0
votes
0 answers

Retain the headers and footers at the start of the document in officedown while using /?

I'm currently generating a Word document using Rmarkdown and the officedown package. I'm using a reference document to set the styles and assign headers and footers on the document. This also includes a different header and footer on the first…
0
votes
0 answers

Duplicate ppt slides officer package

I made a table using flextable package, but when I go to write it I'm given 7 different duplicate slides. Oddly enough, the issue began happening after I added something in to transpose the table, so I'm not sure if that might be the problem. df #…
0
votes
0 answers

Officer Package master_name appear as NA in read_pptx, resulting in 'attempt to apply non-function' error on ph_with

I created a simple slide template with a master template and several layouts, along with their placeholder (slide template attachment in this thread here). Oddly, when I try to read_pptx, it seems to be unsuccessful in picking up the template name…
csbu00
  • 1
  • 1
0
votes
2 answers

iterate through plots and create powepoint slides rmarkdown

I would like to create a powepoint slide deck in rmarkdown by iteratively building the slides for each Day. See example below and code that makes a function to output the plots. I just don't know how to add these plots to a slide deck without saving…
jsimpsno
  • 448
  • 4
  • 19
0
votes
0 answers

Using R! How can I only bold some of the words in a column of a flextable and output it to .docx?

I'm a new 'officer' package user. I'm currently working on a project, which ask me to output a table to .docx. In that table, there is a field called 'Description' which contains some long texts. For example: "This is a description." Now, I have a…
Gang
  • 1
0
votes
1 answer

Package officeR : body_add_gg. Function does not work with a ggsurvplot object for file.docx

I am currently working on a shiny app. This app generates ggsurvplot and I want to export them in a .docx report to avoid screenshots. When I'm adding the ggsurvplot in my report with the function body_add_gg() i got this message error :…
0
votes
1 answer

Automatically adding sections to PowerPoint file knitted from R Markdown

Context I perform data analysis primarily in R, and the final output is typically in the form of one or more MS PowerPoint decks that can be shared with non-technical clients for downstream editing. Over the years, I've streamlined my process to the…
Z.Lin
  • 28,055
  • 6
  • 54
  • 94