Ok, here's a couple of items on how Word builds the TOC field contents. This isn't everything, but it's a couple of the final items we recently got from Microsoft to get our rendering to match Word. (One big thing to keep in mind, you can create some TOC settings where each time you click update, Word switches between two layouts – so there's no canonical way to render.)
First, the rightmost tab is brought in 10 twips from the right margin. Why? "Its purpose is to prevent what is called "breakthrough tabs" or tab settings beyond the margin, which cause text to be clipped." And this is a Word implementation detail and as such is subject to change. My guess is this was brought in with content controls as a TOC in a content control is a bit more constrained for space.
Second is the formatting for the TOC lines:
One particular style seems to control whether Word adds a dotted tab leader upon updating or not (in the absence of TOC1, 2, 3 styles). The "TOC Heading" style is built-in and if present in styles.xml, it's tab setting will determine if tabs have dotted leaders. If the style is missing, then updates will result in the default dotted leader being added back in, provided that TOC1, 2, 3, etc… don't have tab styles defined. If this style appears in your styles.xml means that it has been used at some point in the history of the document and possibly modified from its original definition. Word uses that as a deciding factor in updating the styles of the result field.
So "TOC Heading" overrules TOC1, etc. for tabs.
Comments