I received a helpdesk ticket today from a user who was having trouble opening an Excel workbook.
I was recently working with a report template where a numbered Heading 1 had a colour and size assigned to the actual number style. This was then causing problems on the table of contents because the number’s style was showing up there too.
The problem is though, it’s impossible to remove the formatting on that number via the UI in Word. By default, the colour is set to “No Color”, but it’s impossible to go back to that setting once a colour has been chosen.
I didn’t want to re-create the entire document as it had macros embedded, and also had a lot of work done already. Luckily, all of this information is stored in XML format, so it’s not too hard to find.
To remove this style information from the number, do the following with a backup of your file.
- Rename the file extension to .zip (I usually just append .zip to the existing filename)
- Copy out the Word folder from within the zip file to somewhere temporary
- Open numbering.xml from the unzipped word folder with something like XML Notepad
- Search for the name of your style. In my case, it was “Heading1” (note the lack of a space between “Heading” and “1”. The style is actually called “Heading 1” in Word:
- Once you find that style, drill down to the w:rPr node. You can see here that a style and colour is defined for the numbering associated with Heading 1
- Remove everything under w:rPr except for w:rFonts->w:hint (I’m sure you could remove this too, but it was there by default for other styles)
- Save the XML file
- Copy the XML file back into the word folder in the zip file
- Rename the file extension back to what it originally was. In my case, it was .docm
- Open the file in Word, and inspect the result. Hopefully, it succeeds for you as it did for me:
Remember: Do this with a backup copy of your file in case you somehow manage to corrupt it.