1

Is it possible to make the documents by Officer R package both A3 and Landscape?

I can make the document and pass in objects without problem for portrait and A4 but I can not find any documentation on how to make A3 or change orientation.

mydoc <- read_docx()

I have tried

mydoc <- page_size(width = 11.5, height = 16.5)

If it can not be done in Officer R is there another package out there that could do it?

thanks

Spooked
  • 586
  • 1
  • 4
  • 16
  • There are examples in the documentation and in the user manual: https://ardata-fr.github.io/officeverse/officer-for-word.html#add-sections – David Gohel Mar 25 '21 at 08:35
  • @DavidGohel thanks for the link. From what I can see the examples in that link are about maximizing the image size to the match the page dimensions, not changing the page dimensions. using the examples in the link you provided I tried doc_gg <- page_size(width = 11.5, height = 16.5) , however, without any success – Spooked Mar 25 '21 at 10:38
  • no sorry, the examples are about managing section. – David Gohel Mar 25 '21 at 11:05
  • > To format your content in a section, you should use the body_end_block_section function. First you need to define the section with the block_section function, which takes an object returned by the prop_section function. It is prop_section() that allows you to define the properties of your section. – David Gohel Mar 25 '21 at 11:06
  • Did you do any progress with A3 and Landscape orientation with Officer? I've the same problem. I try to define just one page of my report in a A3/landscape – itamar Dec 03 '21 at 00:28
  • @itamar unfortunately not. I only really needed for a one of project so I never pursued it any further – Spooked Dec 04 '21 at 01:35

1 Answers1

0

I think I found a way:

library(officer)
library(knitr)

I created 2 objects and I put the figure between them:

open_A3 <- block_section(prop_section(type = "continuous"))


close_A3 <- block_section(prop_section(page_size = page_size(width = 16.5354, 
                                                 height = 11.69291,
                                                 orient = "landscape"),
                           type = "continuous"))

The width = 16.5354 and height = 11.69291 in page_size() function correspond the A3 dimensions.

So, with:

# Title 1

## Title 1.1
{r, echo = F}
open_A3
{r Paris, fig.align='center', fig.height = 8.4566929, fig.width = 13.50394, echo = FALSE}

include_graphics("paris.jpg")
{r, echo = F}
close_A3

I got it:

capture

itamar
  • 193
  • 5