rfortherestofus / omni

RMarkdown template, ggplot2 theme, and table function for OMNI Institute
https://rfortherestofus.github.io/omni/
Other
21 stars 5 forks source link

Word template feature request: custom footnote text #88

Closed OskaratOmni closed 15 hours ago

OskaratOmni commented 5 days ago

Hey @dgkeyes and @tvroylandt
I hope you are both well - I have a feature request for our OMNI Word template. I'm not sure its possible because of how fields work with Word but would love to hear what you think.

Currently the footer populates the document title, such that if the yaml says:

---
title: "FRCA Report"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
    omni::omni_word_report_new
---

The footer will say: FRCA Report | page#

What I'm wondering is if we can override this somehow, perhaps with something specified in the yaml?

So we'd have a situation like this -

---
title: "FRCA Report"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
    omni::omni_word_report_new
footnote_text: "This report is great" 
---

The footer will say: This report is great | page#

I tried a couple of workarounds to see if I could make this happen without messing with the template. One was to see I could over-ride the text in the Word doc after knitting.

doc <- read_docx("word_test.docx")

doc <- body_add_par(doc, "Here is a note", style = "footer") # this was a chatgpt suggestion. I can't verify that this is even a valid argument

print(doc, target = "word_test_newfooter.docx")

So the goal would be to put whatever text we want in the footer. I assume that we cannot do this with css because of how Word handles fields but I am not sure. Do you see a way to do this? Thanks!

dgkeyes commented 4 days ago

@tvroylandt and I just chatted about it. He'll take a look and let us know if it's possible.

OskaratOmni commented 4 days ago

Thank you! I realize that it might not be possible, but if it isn't too hard to figure out, that's great.

tvroylandt commented 4 days ago

This is exactly the question you have : https://github.com/davidgohel/officedown/issues/39

And the answer is : it's not possible inside the Rmd and really complicated and kind of a hack outside.

OskaratOmni commented 21 hours ago

Thanks @tvroylandt , this answer is pretty close to what I expected. In fact, I tried and failed an approach a little similar to the one in that thread, but mine was even more of a hack because it was outside a knitr function. Well, that doesn't matter because it didn't work anyway.

Can you please give your professional opinion on advice I can bring to the team who made this request?

Here's what I'm thinking as general advice:

@tvroylandt Does those two bullets seem broadly similar to your take on the issue? And/or anything you would add? (@dgkeyes what do you think?)

Thanks!

dgkeyes commented 15 hours ago

@OskaratOmni your assessment and summary of the situation sounds right to me. The general advice you offer is spot on. In general, we find that HTML is easiest to customize, PDF second, and Word least easy. Hope that helps!

tvroylandt commented 2 hours ago

I agree with David