Skip to contents

Reads in a .docx file and returns a new version with bookmarks removed from the document.

Usage

remove_bookmarks(docx_in, docx_out)

Arguments

docx_in

Path to the input .docx file

docx_out

Path to output .docx to save to

Examples

if (FALSE) { # \dontrun{

# ---------------------------------------------------------------------------
# Load all dependencies
# ---------------------------------------------------------------------------
docx_in <- file.path(here::here(), "report", "shell", "template.docx")
doc_dirs <- make_doc_dirs(docx_in = docx_in)
figures_path <- file.path(here::here(), "OUTPUTS", "figures")
tables_path <- file.path(here::here(), "OUTPUTS", "tables")
footnotes <- file.path(here::here(), "report", "standard_footnotes.yaml")

# ---------------------------------------------------------------------------
# Step 1.
# Table addition running add_tables will format and insert tables into the doc.
# ---------------------------------------------------------------------------
add_tables(
  docx_in = docx_in,
  docx_out = doc_dirs$doc_tables,
  tables_path = tables_path
)

# ---------------------------------------------------------------------------
# Step 3.
# Next we place in the plots using the add_plots function.
# ---------------------------------------------------------------------------
add_plots(
  docx_in = doc_dirs$doc_tables,
  docx_out = doc_dirs$doc_tabs_figs,
  figures_path = figures_path
)

# ---------------------------------------------------------------------------
# Step 4.
# Now we can add the footnotes to all the inserted figures and tables.
# ---------------------------------------------------------------------------
add_footnotes(
  docx_in = doc_dirs$doc_tabs_figs,
  docx_out = doc_dirs$doc_draft,
  figures_path = figures_path,
  tables_path = tables_path,
  footnotes = footnotes
)

# ---------------------------------------------------------------------------
# Step 5.
# Clean the output for a final document creation. This will remove the ties
# between reportifyr and the document so be careful!
# ---------------------------------------------------------------------------
remove_bookmarks(
  docx_in = doc_dirs$doc_draft,
  docx_out = doc_dirs$doc_final
)
} # }