Questions tagged [officer]

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

413 questions
1
vote
1 answer

Changing font/color/style of text using body_add_par from the officer package in R

Hi there I want to be able to change the style, font, and color of my text in body_add_par from the officer package. Is there a simple way to do this? Note: I was able to change the font, size, and color) using fp_text (see directly below) but then…
1
vote
1 answer

Using MS Word documents as reference data unit tests in R

I'm working on a code that generates MS Word documents as output. I generated few documents with revised content which I'd like to use as a reference documents in my unit tests. The idea is - generate a document based on input data X -> compare it…
Jakub Małecki
  • 483
  • 4
  • 14
1
vote
1 answer

How to delete specific slides on officer?

I'm reading in some slides that are no longer useful/necessary. I know that with remove_slide allows me to remove a specific slide, but it doesn't allow for the ability to put a list starting from slide 3 to the last one.…
1
vote
0 answers

R not finding function read_docx() in library "officer"

I'm stuck, I think, trying to use R which I barely learned 5 years ago to read and parse a word document. I'm looking at the following webpage: https://www.r-bloggers.com/2020/07/how-to-read-and-create-word-documents-in-r/ So I do the following and…
elbillaf
  • 1,952
  • 10
  • 37
  • 73
1
vote
1 answer

Multiple flextables in Word using bookmarks and officer

I want to add two flextables at two bookmark locations in 1 Word document. However, when the second one gets added, it puts the second table at the bookmark of the first, and the first table is not in the Word document. Has anybody else had this…
Irissie-2
  • 13
  • 5
1
vote
2 answers

How to render the contents of a Word document including formats in a Shiny App instead of manual HTML coding?

I'm working on an App that generates large amounts of text in response to user definitional questions. I'm coding text in using HTML in separate modules, and it is becoming very cumbersome to code in all this text mainly due to the HTML coding…
Village.Idyot
  • 1,359
  • 2
  • 8
1
vote
1 answer

Cursor location for multiple matches (Officer Package in R)

I am trying to identify the exact location to insert/replace items using Officer package in R For example: cursor_reach(document, "Adverse Events") would find the first adverse event wording match only. So if I had a text about Adverse Events, the…
Steve S
  • 13
  • 2
1
vote
1 answer

Extract the text of word documents by page instead of paragraph (R)

I currently have a (large) amount of text data in (hundreds of) .pdf and .docx files. I would like to extract the text per page as later in the analysis, page numbers become relevant. For the pdf files, I'm using the pdftools package, which works…
Rasul89
  • 588
  • 2
  • 5
  • 14
1
vote
1 answer

Why is R's officer/officedown moving my header down to the bottom of the page?

I only have one "heading 1" and yet it's at the bottom acting like it's the second header. Is there something I'm not aware of? Code with example data: library(flextable) library(dplyr) library(officer) library(officedown) df <-…
Anonymous
  • 453
  • 1
  • 6
  • 14
1
vote
1 answer

How to add text at beginning of Word document?

I'd like to add content at the beginning of a Word document. Important note: this document already has content, I want to add content BEFORE text that is already in this file. something like: # input file text blah blah blah blah blah blah # output…
kwadratens
  • 187
  • 15
1
vote
0 answers

Using alt_text argument in ph_with() function for PowerPoint

library(officer) library(flextable) library(tidyverse) x <- read_pptx() data_flex <- flextable(iris) y <- add_slide(x, layout='Title Slide') %>% ph_with(value=data_flex, location=ph_location(left=0.5, top=0.5), alt_text =…
Josh
  • 33
  • 4
1
vote
0 answers

Get comments from pptx slide

I was wondering if there's a way from officer to capture the comments of a slide / add comments to a slide in PPTX? I'm interested in using R to autoupdate an existing PPTX slide deck. When a reviewer makes a comment on a slide that gets…
joebro234745
  • 11
  • 1
  • 1
1
vote
1 answer

removing markers from linechart in mschart

I am using officeRand mscharts to create powerpoints from R. I have ran into a problem where I dont know how to remove the markers from the line charts. The mschart package says that from version 0.3.1 you are able to have line charts with or…
zimia
  • 930
  • 3
  • 16
1
vote
1 answer

Combine multiple docx with columns in officer R

I am trying to use the officer package in R to create multiple outputs with columns and then combine the outputs into a single document. I am able to create the initial outputs with columns, but when I combine them with body_add_docx() the column…
Mxblsdl
  • 484
  • 6
  • 16
1
vote
1 answer

Get slide layout names for each slide in rpptx object

I want to be able to pass an rpptx object into a function that outputs a character vector of slide layout names for each slide in the object. For example, using a fictitious get_slide_layouts() function: pres <- officer::read_pptx() pres <-…
Giovanni Colitti
  • 1,982
  • 11
  • 24