Questions tagged [officer]

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

413 questions
0
votes
0 answers

Writing a function with an officer method (ph_with)

I have written a simple script to create some PowerPoint sheets based on an Excel dataset. For the original script see Picture1. I noticed that the code becomes very unreadable if you add to many objects to one PowerPoint sheet. That's why I wanted…
Robg
  • 1
  • 2
0
votes
0 answers

Flextable R activate page break for a table in Word

I am using the officer and flextable packages to write reports in word. When I use the body_add_flextable() function, the tables always start on a new page because the "do not separate from the next paragraph" is activated in Word paragraph…
zies
  • 3
  • 3
0
votes
0 answers

R For Loop iteration number when using non-numeric identifiers

I have a for loop that creates a series of maps for each of the unique crimes types in a list. These maps are then exported to a powerpoint presentation pres_1. for(i in unique(crime_df$crime_type)) { crime_map <- ggplot(data = filter(crime_df,…
Ant
  • 313
  • 5
  • 19
0
votes
0 answers

Embedding cells form one table into cells of an existing Word tables at a bookmark with flextable and officer

In Word, it is possible to copy and paste a subsection of one table into another table. For example, if I have the two Word tables below, I can copy column 2, rows 2-5 from the first table and paste them into column 2, rows 4-7 in the second…
Brad Cannell
  • 3,020
  • 2
  • 23
  • 39
0
votes
1 answer

combo charts in R mschart

Is there a way to create combo charts using mschart. I am trying to create a chart where one column of the data will be a line chart and another column would be a bar chart. The below code doesnt work. library(tidyverse) library(mschart) mtcars %>%…
zimia
  • 930
  • 3
  • 16
0
votes
1 answer

How to get R to skip a line rather than throwing an error (when try() and is.error() are not working)?

I'm trying to use officer to make a report. However, sometimes, the plots that I want to add don't have enough data, so rather than throwing an error, I just want R to leave a blank space where that plot would go. However, I've tried using try() and…
J.Sabree
  • 2,280
  • 19
  • 48
0
votes
1 answer

Seeing "internal error: Huge input lookup [1]" error when trying to create a large powerpoint file using OFFICER package

I don't have a great way to give a reproduceable example, but here's my best description. I'm running a loop that generates 60 different powerpoint slides, each in officer and creates a list, which results in a "pptx document with 60 slides" in my R…
Sean
  • 3
  • 3
0
votes
1 answer

Modify xml_document in officer in R

I have an rdocx and I want to manipulate something in the xml code. That's my document: library(officer) doc <- read_docx() %>% body_add_par("centered text", style = "centered") %>% slip_in_seqfield("STYLEREF 1 \\s") %>% …
TobiSonne
  • 1,044
  • 7
  • 22
0
votes
1 answer

MS Word number of pages in a flextable table using Rmarkdown

Is there a way to insert MS Word computed field - total number of pages in the document - into a flextable table? In the officer package there's a function run_word_field. I tried to use it the following way: flextable(df) %>% compose(value =…
Jakub Małecki
  • 483
  • 4
  • 14
0
votes
1 answer

body_add_img with custom image size

I want to add images to a serie of docx.files. But I do not want to change their size - each image has different width and height. How can I specify this for every imagine in: sample_doc %>% body_add_img(paste0(data_base$Skizze[[x]],".JPG"),width =…
Nadiine El Nino
  • 339
  • 1
  • 6
0
votes
2 answers

How do I Use Tab Stops in MSWord Documents Created in R?

Background and Objective I am generating a formatted collection of itemized details (similar to a catalog) in MSWord using the officer package. Each item in the collection has a header followed by a line for each defined detail. Each line (header or…
AWaddington
  • 725
  • 8
  • 18
0
votes
1 answer

Officer - paste text with tabulator

I am trying to integrate 2 tabulators between the string "Name:" and the actual Species name from the iris database. I want to have a formatted text in word.docx. Can someone help me? my_prop_1 = officer::fp_text(font.size = 10, underlined=T, bold =…
Nadiine El Nino
  • 339
  • 1
  • 6
0
votes
1 answer

Line breaks disappear from docx file

When reading a docx file with read_docx the line breaks (soft returns) within paragraphs in the docx file are not read, i.e. disappeared. Is it possible to read the doxc and preserve the line breaks?
0
votes
1 answer

create a summary slide of each row of the dataframe through a loop

I am trying to create a powerpoint presentation with a mix of plots and text. I have the following example data: data <- structure(list(School_ID = c("J-56124", "T-65451", "D-78544", "TBD", "B-78664"), Release_Date = structure(c(18659, 19024,…
Maral Dorri
  • 468
  • 5
  • 17
0
votes
1 answer

Page numbering in word documents created with officer

when creating documents with officer I am using body_end_section_portrait() and body_end_section_landscape() to set up orientations. library(officer) doc <- officer::read_docx() doc <- officer::body_add_par(doc, "bla1", style = "Normal") doc <-…