MSFT released hot fix for Excel 2007 custom styles duplication

On April 26th Microsoft released hot fix that stops styles related corruption from spreading in Excel 2007: which in combination with should prevent custom styles from getting out of control. Anyone on Excel 2007 who is affected by the custom styles explosion problem should apply this hot fix.
Good news: this fix will stop styles related issues from duplicating from workbook to workbook on cross instance copy/paste in Excel 2007.
Not so good news: the hot fix applies only to Excel 2007. Users on Excel 2010 have to wait. One issue that I got to work on this week with Robert related to hidden styles in Excel 2010 won’t be resolved by this hot fix. It should come soon though I think.
This fix will NOT remove existing styles corruption from the workbooks, so you still need to clean up your existing workbooks with my tools, VBA or manually even after you apply this fix. Please share your experience with the fix if you applied it. It would be very helpful to everyone who gets to this blog. Huge Thank You goes to Robert for leaving very detailed description of the situation in his organization. Your message got delivered to the right audience and that is how I got pointed to this KB article.

This entry was posted in Computers and Internet. Bookmark the permalink.

15 Responses to MSFT released hot fix for Excel 2007 custom styles duplication

  1. Robert says:

    So… I installed the hot fix (can provide screenshot) and then rebooted.
    -I opened up two Excel 2007 instances manually.
    -I dragged “Book2.xlsx” into one – 621kb of styles, no actual content. (This corruption was caused by copying a single blank cell from a much larger corrupt Workbook).
    -I opened a brand new workbook in the other.
    -Copied one cell from the corrupt into the new.
    The corruption seemed to carry through, as the new workbook is now 621kb after being saved.

    One thing to note: I *do* have 2010 installed on the same computer; however, that shouldn’t interfere. I don’t have a 2007 only computer I can test on from home.

  2. Robert says:

    I found someone who left their WinXP computer on over the weekend and it only had Office 2007 on it. I performed the same steps and was still able to reproduce the corruption when pasting a single cell from a corrupt workbook into a brand new workbook if opened in different instances.
    Thanks so much to everyone spending time on this!

  3. XLGeek says:

    Robert, can you confirm please:
    1. Cross-instance copy/paste continues to grow the number of custom styles. My understanding of this QFE is that yes, first paste will bring new styles in, but next paste action will recognize that the style definition is already present in the destination workbook and not add a new one.
    2. Hidden styles should not be pasted into the destination workbook at all. Can you see hidden styles still? You’ll have to look inside styles.xml part for that.
    Thank you in advance for feedback. Lots of people affected by this issue read this blog and you can really help the community here.

  4. Robert says:

    Now I’m just getting weird results… :-).

    Control: Server 2003 Computer (Our TS) – No Patch:

    File 1 (60,000 Corrupted Styles, includes Hidden)
    Copied a single cell from a corrupt workbook into a new workbook. 60,000 styles copied including a bunch that were “Custom Built In” and “Hidden.”
    Second Copy did not work at all (no error, but copy/paste results in nothing being pasted…).

    File 2 (1241 Corrupted Styles)
    First Copy -> Paste puts 1241 styles.
    Second Copy -> Paste bumps total to 1280 styles.
    Third Copy -> Paste bumps total to 1327 styles.
    (Didn’t double every time as I expected, but still grew fairly fast).

    Test 1:Server 2003 Computer – Patch:

    File 1
    First copy included all duplicate styles *except* no Hidden / Custom Built In. Strange thing here is that I think it may have been the “save” process that removes this. My reasoning for thinking this is that when I save, for a split second I can see it jump from 9kb up to ~600kb (the size of the one in my first test) and then readjust down to ~450kb.
    Second copy; however, has the same result as the Control in that nothing gets copied over.

    File 2
    First Copy -> Paste puts 1241 styles.
    Second Copy -> Paste puts 1244 styles.
    Third Copy -> Paste puts 1247 Styles.

    Test 2: Windows XP SP3 – Patch.

    File 1
    Same exact results as Test 1.

    File 2
    Same exact results as Test 1

    What I believe is happening:
    1. The hidden styles copying is fixed.
    2. If the file isn’t very corrupted, the corruption is *reduced* (but still grew by 3 styles per copy).
    3. If the file is very corrupted, it isn’t fixed at all.

    What I am wondering, but can’t test right now, is if the cleaning is done on save or at least after copy. Is it possible that it needs to have room to paste all styles in *first* before it can then do the routine to determine if some should be removed? If a file is already 60k corrupted, perhaps there isn’t room to do this logic?

  5. XLGeek says:

    Robert, thanks again for testing this. I got a word that you may also need to apply this hotfix that came out a year ago: for full effect. I haven’t had time to try both fixes myself yet (need to re-build a VM for that), so really appreciate you picking up the slack. I updated the post. Really want to test out your idea on getting close to the limit. It looks like either way existing workbooks need to be stablized.

  6. Robert says:

    I will have to admit that I am completely confused by my results now!
    On my Windows 7 machine I built a Windows XP Mode virtual machine, and installed all Windows updates. I then installed Office 2007 (Excel only) and started testing.
    For a fresh copy of Office, in all of my tests multiple copies from the same source into the same destination added extra styles; however, the actual increase was only a fraction of the total corruption. That being said, the FIRST copy didn’t copy in all styles, just most.
    (IE – Corrupt document had 1245 styles, copied in 1232, grew to 1280 after second copy and then 1328 after the third).
    My next smallest file tested had 34447 styles in the source, in the first paste to the destination 34395 styles copied over. My 2nd paste corrupted the document beyond the ability to open it again (max styles ID now 655535 but only 34396 node count, upon trying to open file again i was told the styles.xml was corrupt).

    Next I installed the patch from a year ago – funny thing is that it actually seemed to work in all of my tests. The initial copy copied over *more* corrupt styles than without the patch (34445 vs 34395); however, each of the following copies did not have the count go up.

    Next I installed the newer patch, the difference with the newer patch is that the “hidden” styles did not get copied over… Other than that, all other results were the same.

    So now I’m confused and curious, what was the difference with this machine – why did even the first patch completely fix this machine and yet even with both patches I had issues on two other test machines?
    Could some other patch that is installed be conflicting?

    Has anyone else done any testing to see what affect the different patches have for them?

  7. XLGeek says:

    Couple people hit this post and used the KB links. PLEASE SHARE YOUR EXPERIENCE! This way we help everyone save time. Thanks to Robert for pulling off the bulk of testing for all of us.
    Now, I built clean XP VM and KB articles seem to work as advertised.
    1. Environment: Windows XP SP3 with Office 2007.
    2. Installed patches in this sequence: KB981731 first then KB2534047.
    3. Styles with hidden attribute on don’t get copied to new workbooks (cross instance), so KB2534047 appears to work as advertised.
    4. New styles not present in the destination workbook do get copied in on first paste, but subsequent pasting from the source with the same styles doesn’t add new ones like “20% – Accent1 2 2 2 2” like it used to do before the patch.
    I’ll keep on digging and try to replicate more of Robert’s scenarios. Maybe patch installation sequence really matters? Let’s find out.

    • Robert says:

      It may be the order (which was backwards for me on the original tests) or it could also be that these machines I’ve been testing on (sans the new virtual) are old… All probably started with 2003 and upgraded to 2007. All had many patches on it, some the hotfix request type that “could cause other issues…”
      So it may be that the patch fixes the issue, (if) you have no other problems already on the machine :-).

      As you said – I think it still comes down to the world using your tool to clean up existing files to prevent the spread of duplicate styles!

  8. Tom says:

    With both patches applied the style bloating should not get any worse. Once the files are cleaned of previoulsy created duplicates (using Sergei’s tool)… things should be good.

  9. Al Khadra says:

    I am having similar problems (style bloating) in 2012
    Is there a fix for that yet?

    • XLGeek says:

      Are you talking about Office 15 Beta? All custom styles explosion related fixes included in Office 2010 should be present in the beta.

      • Al Khadra says:

        Yes , is there a fix for Excel 2010?

      • XLGeek says:

        Office 2010 SP1: should contain all styles related fixes as far as I know. The “explosion” effect on copy/paste definetely slows down.

      • Al Khadra says:

        Thanks for your reply
        I tried the excel fix 2007 it does not work!
        I copy and paste and I my target file loaded with custom styles . I use two different instances of excel . One for the source file and another for the target. I keep both on compatability mode as they are originally in excel 2002 .
        Thanks for any help

      • XLGeek says:

        Styles explosion is linked to copy/paste between two separate MS Excel instances. That as it turned out is not officially supported scenario. Have you tried installing Excel 2007 patches in the exact sequence outlined in Robert’s comments above? Installation sequence is important and there is a registry key that needs to be set (I covered it in a recent post). When the fixes are installed styles may get transferred on cross instance copy/paste, but when you save, close and re-open the files in fresh Excel instances they should be free from duplicate styles. Like all people said on this blog: even with all fixes and patches in place you should still run XLStylesCleaner. QFEs, patches and service pack fixes do not remove exisiting file corruption.

Leave a Comment or Ask a Question

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

You are commenting using your 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 )

Connecting to %s