Case of the Corrupted Word Formatting

So I had a Word Document I was reviewing, but the Heading numbers i.e. section x.x all were in black text on black background. Only Heading 3 Style was affected.

image

So I went in to Modify the style, and went through all the options but couldn’t find the setting to reset this style

image

Probably I could have spent more time to find the “correct” way to fix this setting, but I ended up taking the .DOCX file and renaming to .ZIP and extracting the contents. This provided me with a structure like so:

image

I then searched for Heading 3

image

OK I thought styles.xml looks like a good candidate…

In the style definition I couldn’t find anything obvious that would create the black outline…

<w:style w:type=”paragraph” w:styleId=”Heading3″>
  <w:name w:val=”heading 3″/>
  <w:basedOn w:val=”Heading2″/>
  <w:next w:val=”ParaText”/>
  <w:qFormat/>
  <w:rsid w:val=”00F8616A”/>
  <w:pPr>
    <w:numPr>
      <w:ilvl w:val=”2″/>
    </w:numPr>
    <w:spacing w:before=”240″/>
    <w:outlineLvl w:val=”2″/>
  </w:pPr>
  <w:rPr>
    <w:sz w:val=”24″/>
  </w:rPr>
</w:style>

So I then checking numbering.xml. First “Level 1”

<w:lvl w:ilvl=”1″>
     <w:start w:val=”1″/>
     <w:numFmt w:val=”decimal”/>
     <w:pStyle w:val=”Heading2″/>
     <w:lvlText w:val=”%1.%2″/>
     <w:lvlJc w:val=”left”/>
     <w:pPr>
       <w:tabs>
         <w:tab w:val=”num” w:pos=”1134″/>
       </w:tabs>
       <w:ind w:left=”1134″ w:hanging=”1134″/>
     </w:pPr>
     <w:rPr>
       <w:rFonts w:hint=”default”/>
     </w:rPr>
   </w:lvl>

Then “Level 2” which had a lot of Color=”000000″ and Fill=”0000000″ which would be safe to guess means black.

<w:lvl w:ilvl=”2″>
     <w:start w:val=”1″/>
     <w:numFmt w:val=”decimal”/>
     <w:pStyle w:val=”Heading3″/>
     <w:lvlText w:val=”%1.%2.%3″/>
     <w:lvlJc w:val=”left”/>
     <w:pPr>
       <w:tabs>
         <w:tab w:val=”num” w:pos=”1134″/>
       </w:tabs>
       <w:ind w:left=”1134″ w:hanging=”1134″/>
     </w:pPr>
     <w:rPr>
       <w:rFonts w:ascii=”Times New Roman” w:hAnsi=”Times New Roman” w:cs=”Times New Roman”/>
       <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=”0″/>
       <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 removed every line with fill=”0000000″

<w:shd w:val=”clear” w:color=”000000″ w:fill=”000000″/>

I then re-zipped the contents, renamed to .docx and…OK sort of there, but now the heading numbers are gone.

image

So I went back to numbering.xml knowing I was on the right track, and extracted the Level 2 and Level 3 sections and beyond compared them. Ok I could take level 3, but retain pStyle and lvlText from style 2.

image

I took Level 3 and changed

<w:lvl w:ilvl=”3″>
      <w:start w:val=”1″/>
      <w:numFmt w:val=”decimal”/>
      <w:pStyle w:val=”Heading4″/>
      <w:lvlText w:val=”%1.%2.%3.%4″/>

to

<w:lvl w:ilvl=”2″>
      <w:start w:val=”1″/>
      <w:numFmt w:val=”decimal”/>
      <w:pStyle w:val=”Heading3″/>
      <w:lvlText w:val=”%1.%2.%3″/>
      <w:lvlJc w:val=”left”/>

and re-placed the entire <w:lvl w:ilvl=”2″></w:lvl> section into into numbers.xml

I re-zipped the folder, renamed ZIP to DOCX, and voila! My formatting is fixed!

image

Of course if I had a working document with similar formatting styles I could have unzipped that document and replaced the numbering.xml file with the good one.

About chentiangemalc

specializes in end-user computing technologies. disclaimer 1) use at your own risk. test any solution in your environment. if you do not understand the impact/consequences of what you're doing please stop, and ask advice from somebody who does. 2) views are my own at the time of posting and do not necessarily represent my current view or the view of my employer and family members/relatives. 3) over the years Microsoft/Citrix/VMWare have given me a few free shirts, pens, paper notebooks/etc. despite these gifts i will try to remain unbiased.
This entry was posted in Office and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s