Just like in title: I have .docx
document and I'd like to remove all the content from it.
How to do it with officer
?
EDIT
Why I need this? I write several tables, pieces of text and insert some pictures into .docx
documnent and then copy them somewhere else. So, .docx
is a kind of scratchpad. It needs to be cleaned up at some point, otherwise it grows very large, full of content that is not needed anymore (since it was already copied somewhere else).
EDIT 2
I know I could just delete all the content from it when I'm done copying it to it's destination, but I... keep forgeting about this. That's why, I'd prefer to use some R
function to clean up my scratchpad.
Could you just write over the document using print?
doc <- officer::read_docx() # Create blank word doc
doc %>% print('document_name.docx') # Save over existing word doc