Using R 4.0.2, Officer 0.3.14
I produce docx files with landscape orientation using the code below
library(officer)
library(magrittr)
landscape_one_column <- block_section(
prop_section(
page_size = page_size(orient = "landscape"), type = "continuous",
page_margins = page_mar(
bottom = 0,
top = 1,
right = 0,
left = 1,
header = 0,
footer = 0,
gutter = 0
)
)
)
my_doc <- read_docx()
#page 1
my_doc <- my_doc %>%
body_add_fpar(fpar(ftext(paste('Some Text'),
fp_text(font.family = 'Calibri', font.size = 14, bold = TRUE)), fp_p = fp_par(text.align = "left"))) %>%
body_end_block_section(value = landscape_one_column) %>%
body_add_break()
#page 2
my_doc <- my_doc %>%
body_add_fpar(fpar(ftext(paste('Some Other Text'),
fp_text(font.family = 'Calibri', font.size = 14, bold = TRUE)), fp_p = fp_par(text.align = "left")))%>%
body_end_block_section(value = landscape_one_column)
print(my_doc, target = 'test.docx')
It works well except that ad the end of the 2 pages it automatically adds a 3rd page which is empty and not possible to remove both by code or in word.
How can this be solved?
Thank you