'How to omit sections from table of contents in R Markdown with officedown

I am drafting an rmd that needs a Table of Contents and needs to be knitted to Word. I am using the officedown package and while I can get a TOC, I need to have the table not include the Section header for the table of contents. I have this:

---
output:
  officedown::rdocx_document:
    reference_docx: word_styles_ref_01.docx
---



{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.cap = TRUE)
library(officedown)
library(officer)

<!---CHUNK_PAGEBREAK--->    
# Table of Contents 
<!---BLOCK_TOC--->    
<!---CHUNK_PAGEBREAK--->



My report starts here.

# Heading 1
My report starts here.

## Heading 2
And I have this next subsection. 

But I do not want "Table of Contents" to be repeated in the actual table of contents. In the above code it is repeated in the word doc with the page number. Is there a way to not include this in the TOC?



Solution 1:[1]

Try

Table of Contents {.unlisted .unnumbered}

Also try this

Make it level 4 and it won't show up in the toc.

If the table of contents depth is not explicitly specified, it defaults to 3 (meaning that all level 1, 2, and 3 headers will be included in the table of contents).

https://bookdown.org/yihui/rmarkdown/html-document.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1