3

I have been on a search for the past 3 months for a way to be able to show a text on every page of the document. Note that I want this text to be changing so I can't just affix this as a header or a footer. Essentially I want something like this.

Example of desired output 1

The words "XYZ Corp." and "Version:" shall remain constant and shall appear on all pages and "A" would be dependent on a user input thru shiny UI.

Let's say the user input for params$version was B then this should be the output for all the pages of the rendered document.

Example of desired output 2

I have read everything about using a reference document and yes, I am using a reference document on my actual code to actually format the contents of my word doc. However, no matter how much I try to edit one of the 'heading styles' to make it look like an actual header just like how I wanted to be, I am unsuccessful to have it appear on multiple pages of the document. Essentially, if I edit the styles and have:

cat("#", "XYZ Corp.", "                ", paste("Version:", params$version))

I am only able to have the output in the first page of the document but unsuccessful to have it appear on the succeeding documents.

TL;DR: Ideally I want to be able to edit the headers dynamically by being able to edit it through user input. However, if that is not possible, I am thinking that maybe there is a way to be able to print certain pieces of text on the word document that is to be rendered.

Yihui Xie
  • 28,913
  • 23
  • 193
  • 419
potatopainting
  • 103
  • 1
  • 9

0 Answers0