79276100

Date: 2024-12-12 17:55:35
Score: 0.5
Natty:
Report link

This has been answered here (https://github.com/davidgohel/officedown/discussions/103) but took me some time to understand and implement, so I am summarising for you here. Basically, put this section after your 'setup' section:

```{r pagenumberingfix}

 #see https://stackoverflow.com/questions/67032523/when-using-officedown-changing-from-portait-to-landscape-causes-problems-with-pa

footer_default <- block_list(fpar(run_word_field(field = "PAGE"),
                                  fp_p = fp_par(text.align = "center") ))

block_section(prop_section(footer_default = footer_default))
```

In your 'setup' section above it, make sure your knitr options are set to prevent code, but not the results from appearing in the finished file - so that the above code code is not shown in the finished file. For some reason if you try to do it with '{r pagenumberingfix, include=FALSE}' as the header, it won't work. Your 'setup' section should look something like this:

knitr::opts_chunk$set(echo = FALSE)
library(officedown) # 0.3.0
library(officer) # 0.6.2

Hope this works for you!

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: befriendabacterium