OK, well this did not get resolved by doing any of the above.
Here is what I discovered to solve the problem. I did not discover why it happened, but it appeared that Microsoft Word got very enthusiastic in adding font attributes to my fifth level heading style.
- I saved my bad TEMPLATE in Xml format. Only one style, in a multilevel list, was fouled up -
Heading 5.
- I scanned the Xml using a professional PLAIN TEXT EDITOR (http://www.zeusedit.com), not Word, for the string
Heading5 (note there is no space in the object name although the visible name in Word is
Heading 5 with a space.
- When you initially open the file, the Xml is all in one huge long string, you will probably have to use a text editor that can reformat Xml, such as Visual Studio, or Xml Spy, or whatever.
- Heading5 is referenced several places. It is clear where it gets referenced in the text of my template (I can see for example the dummy text I use to evaluate styles), and it is found perhaps 3 more times.
- Comparing the Xml for Heading4 to Heading5 where it is referenced in list levels, I see the following:
Here is heading4 (Yes, I know, it says it is list level 3, because presumably list levels start with 0 because of geek assumptions) This Xml for well-behaved Heading4 is fairly simple. You can see things like the left indent is 1512 magic units (pixels?) and hanging indent, font, font size is 24 (which is approx. 12pt), etc.
Depending on the stuff you have done to your styles, YMMV but there are typically not so many 'attributes').
*What matters is between the two <**w:lvl>...</:w,lvl>*tags which represent the multilevel list (levels -get it?)
...
...
<w:lvl w:ilvl="3"><w:start
w:val="1"/><w:numFmt w:val="decimal"/><w:pStyle w:val="Heading4"/><w:suff
w:val="space"/><w:lvlText w:val="%1.%2.%3.%4"/><w:lvlJc
w:val="left"/><w:pPr><w:ind w:left="1512"
w:hanging="1512"/></w:pPr><w:rPr><w:rFonts w:ascii="Calibri"
w:hAnsi="Calibri" w:hint="default"/><w:b w:val="0"/><w:i w:val="0"/><w:sz
w:val="24"/></w:rPr></w:lvl>
...
...
Here is the corrupted Heading5, which I found right after Heading4. Unlike the simple example above, it has a truly amazing number of bogus attributes associated with it - none of which I set. See for example, w:imprint, w:vanish, w:specVanish. Who knows what these are? Not me. Presumably one or more of these is hosing up the style.
...
...
<w:lvl w:ilvl="4"><w:start
w:val="1"/><w:numFmt w:val="decimal"/><w:pStyle w:val="Heading5"/><w:suff
w:val="space"/><w:lvlText w:val="%1.%2.%3.%4.%5"/><w:lvlJc
w:val="left"/><w:pPr><w:ind w:left="1944"
w:hanging="1944"/></w:pPr><w:rPr><w:rFonts w:ascii="Calibri"
w:hAnsi="Calibri" w:cs="Times New Roman" w:hint="default"/><w:b
w:val="0"/><w:bCs w:val="0"/><w:i w:val="0"/><w:iCs w:val="0"/><w:caps
w:val="0"/><w:smallCaps w:val="0"/><w:strike w:val="0"/><w:dstrike
w:val="0"/><w:outline w:val="0"/><w:shadow w:val="0"/><w:emboss
w:val="0"/><w:imprint w:val="0"/><w:noProof w:val="0"/><w:snapToGrid
w:val="0"/><w:vanish w:val="0"/><w:color w:val="000000"/><w:spacing
w:val="0"/><w:w w:val="0"/><w:kern w:val="0"/><w:position
w:val="0"/><w:sz w:val="20"/><w:szCs w:val="0"/><w:u w:val="none"
w:color="000000"/><w:effect w:val="none"/><w:bdr w:val="none" w:sz="0"
w:space="0" w:color="000000"/><w:shd w:val="clear" w:color="000000"
w:fill="000000"/><w:vertAlign w:val="baseline"/><w:em
w:val="none"/><w:lang w:val="x-none" w:eastAsia="x-none"
w:bidi="x-none"/><w:specVanish w:val="0"/><w14:glow
w14:rad="0"><w14:srgbClr w14:val="000000"/></w14:glow><w14:shadow
w14:blurRad="0" w14:dist="0" w14:dir="0" w14:sx="0" w14:sy="0" w14:kx="0"
w14:ky="0" w14:algn="none"><w14:srgbClr
w14:val="000000"/></w14:shadow><w14:reflection w14:blurRad="0"
w14:stA="0" w14:stPos="0" w14:endA="0" w14:endPos="0" w14:dist="0"
w14:dir="0" w14:fadeDir="0" w14:sx="0" w14:sy="0" w14:kx="0" w14:ky="0"
w14:algn="none"/><w14:textOutline w14:w="0" w14:cap="rnd" w14:cmpd="sng"
w14:algn="ctr"><w14:noFill/><w14:prstDash
w14:val="solid"/><w14:bevel/></w14:textOutline><w14:scene3d><w14:camera
w14:prst="orthographicFront"/><w14:lightRig w14:rig="threePt"
w14:dir="t"><w14:rot w14:lat="0" w14:lon="0"
w14:rev="0"/></w14:lightRig></w14:scene3d><w14:props3d w14:extrusionH="0"
w14:contourW="0" w14:prstMaterial="none"/><w14:ligatures
w14:val="none"/><w14:numForm w14:val="default"/><w14:numSpacing
w14:val="default"/><w14:stylisticSets/><w14:cntxtAlts
w14:val="0"/></w:rPr></w:lvl>
So, I scrape the stuff out of Heading4 between the w:lvl tags that seems reasonable, working under the assumption that I can tweak the style if I can just get the template to load, and I have the following xml for Heading5. I changed the value of <w:sz to 20 because this heading is supposed to be 10 pt..
...
...
<w:lvl w:ilvl="4"><w:start
w:val="1"/><w:numFmt w:val="decimal"/><w:pStyle w:val="Heading5"/><w:suff
w:val="space"/><w:lvlText w:val="%1.%2.%3.%4.%5"/><w:lvlJc
w:val="left"/><w:pPr><w:ind w:left="1944"
w:hanging="1944"/></w:pPr><w:rPr><w:rFonts w:ascii="Calibri"
w:hAnsi="Calibri" w:cs="Times New Roman" w:hint="default"/><w:b
w:val="0"/><w:i w:val="0"/><w:sz
w:val="20"/></w:rPr></w:lvl>
...
...
Basically, I replaced the entire <w:rPr>...</w:rPr> tag section and voila', my template opens and the style is corrected (enough).
End Notes
This hacking is clearly not for the faint of heart but way faster than fixing tons of templates or documents. It is probably only doable in a template and NOT in a real gigantic document with possibly hundreds of thousands of lines of Xml.
The following procedure/ rules must be observed:
- Save the offending template as a Word xml document. Native to Word 2010, probably 2007
- Open the file created in xml with a TEXT EDITOR, not WORD.
- Find the stuff carefully, compare carefully, decide what needs to be eliminated/simplified. Use the Xml from a working style as your new source (as shown above).
- DO NOT insert any extra spaces, random carriage returns, or whatever, and be very careful to make sure your tags close as in the above example and that all the attributes are surrounded with double quotes as in the example. For each tag, there will either
be a closing /> in the same tag e.g. <w:val="1"/> or if the tag encompasses other tags, a closing tag for it will be at the end of the section as in the
<w:lvl>......... </w:lvl> example above.
- I have no clue how hard it would be if you have multiple corrupted styles. Presumably they will start to heal one by one as you make these repairs. It is hugely helpful to have example text in the template document to see the stuff visually.
- Save your template as plain text, no special formatting etc. etc. This is a setting WordPad for example. NotePad should save it that way by default. Both suck as text editors though, I use Zeus, but Visual Studio or Ultraedit or whatever should be able
to handle this.
- Reopen any documents based on the template and verify that all is well.
Good luck. I cannot provide technical support so please, don't ask. Thank you.