WORD header using conditional field code ( e.g. with IF & StyleRef)

by Gustaf   Last Updated November 16, 2018 20:01 PM

My Word document has the headings with numbering and numbering begins with Chapter 1, 2,3 omitting ToC(Table of Content), i.e.:

1 Chapter One
1.1 Subchapter one 
... 
2 Chapter Two

I would like to have the header with both numbering and its title (heading 1 only), but not for the ToC (Table of Content). If I use this field code:

{ STYLEREF  "Heading 1" }  

It will only show the chapter title, no numbering. But If I use a combined field codes (1st part is number, 2nd is title):

{ STYLEREF  "Heading 1"\w}  { STYLEREF  "Heading 1" } 

But ToC will show as:

0 Table of Content

This is ugly! So I am now struggling how to get rid of the "0"?? I am thinking of conditional function IF for header, something like:

 IF Heading number is 0, then show only title, 
 IF Heading number is not 0, then show both number and title.

I tried many times using IF with STYLEREF, but seems both cannot be combined, nevertheless this IF works fine:

{ IF 3 > 0 "YES" "NO"} 

Does anyone have a better solution? Thanks in advance.



Related Questions


MS Excel 2016 conditional formatting

Updated April 05, 2017 17:01 PM


Whats wrong with my Excel conditional formatting?

Updated March 26, 2018 14:01 PM


Display email as plain-text/HTML depending on sender?

Updated November 16, 2018 10:01 AM