Issue Table Of Content Setting Related Issue

How can use ‘do not show in table of content’ setting during generate the heading in template using code .

@RiteshK10 “Do not show in table of content” option in the TOC menu in MS Word resets style of the paragraph so it does not appear in the TOC. You can achieve the same by resetting the style programmatically, for example by setting StyleIdentifier of the paragraph.