I am generating reports in Word using R officer package. I want my reports to contain table of contents, list of figures and list of tables, but when I add them, there is a warning "This document contains fields that may refer to other files. Do you want to update the fields in this document?". So in every report I have to click 'Yes' and then save changes in the report so the window does no show up again.
My question is if it's possible to do these three steps: opening the ready report, clicking 'Yes' when the window shows up and saving the changes in some sort of code?
I've been searching through the Internet, but haven't found anything that would help me. Microsoft website provides some articles that seem related to my problem, such as this one: https://learn.microsoft.com/en-us/visualstudio/vsto/how-to-programmatically-open-existing-documents?view=vs-2019, but I don't really understand if they answer my question.
I will appreciate any suggestion on the software I should use to do this and/or sample codes.