none
Word 2010 table style problems RRS feed

  • Question

  • We've been using the following (simplified) setup for our reporting solution for a few years now:

    • report "templates" are designed as WordML files, with styles defined in a regular Word template
    • custom XML tags are used as markers for repeatable regions and data placeholders
    • repeatable regions are duplicated as necessary, and placeholders filled with the final data (direct XML manipulation)
    • multiple reports are concatenated into a single final document, based on a customer-specific template (Word automation)

     

    With Word 2003 everything worked as intended, including automatic updates of styles through the customer-specific template. With Word 2010 we are experiencing a number of problems though, all in regard to table styles:

    1. After a "Save as", all tables suddenly lose their assigned table style. They (mostly) keep their original format, but attaching the customer-specific template doesn't update them anymore because they are all "Table Normal" style now.
    2. When the report features repeating tables, even the original format seems to break down (in a non-deterministic fashion). From some point in the document onwards, all remaining tables are suddenly displayed as "Table Normal" instead of their originally assigned style.

    Has anybody experienced similar problems with table styles and was able to address them?

     

    As a workaround, we've tried saving all the table style assignments after the initial document load, and re-applying them when the final document is displayed. This seemed to work initially, but results in some "broken" styles on further inspection. For example, two table styles that have conditional formatting for the last row active, display those rows in "full table" format (even in the style preview on the ribbon).

    Any ideas why a table style might suddenly break like this, or for other workarounds that could enable us to restore the intended visual appearance?

     

    with regards,

    Tobias

     

    Friday, November 25, 2011 12:44 PM

Answers

  • Hi Tobias

    <<Is there any documentation on how the handling of table styles has "changed subtly"?>>

    Not that I know of. Fact is, table and list styles are no longer included in the tools used to manage styles, as they were in 2003. They're no longer listed in the Styles pane, for instance. This indicates a change of "perception" on the part of the MS team. I don't know what else may have changed "under the covers", specifically.

    I do know that, when a document goes through a conversion process (for example, a 2003 document opened in 2002 or saved to RTF, that kind of thing) that table and list styles will be lost and exhibit the same behavior you describe (formatting is retained).

    So, given what I know, I'd check to what file format these documents are being saved in. You may be assuming it's the docx file format, but perhaps it's not...


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by twolf_chsoft Tuesday, November 29, 2011 10:21 AM
    Monday, November 28, 2011 10:47 AM
    Moderator

All replies

  • I don't use table styles simply because I found them too difficult to consistently control programatically and there's no way that my customer base would ever understand how to use them even if we tried to explain.

    In my applications for table cells that I want to control, I have stuck to using unique Paragraph Styles.

    Take a look at this this thread from September 2011 and maybe it will help you decide what to do in your application.

     http://social.technet.microsoft.com/Forums/en-US/word/thread/5d137988-9bcb-4d26-b17b-33ed2cb2c130 


    Kind Regards, Rich ... http://greatcirclelearning.com
    Friday, November 25, 2011 10:47 PM
  • Hi Tobias

    Word 2003 based on the old *.doc file format and, as you say, WordProcessingML was the XML vocabulary.

    Word 2007/2010 are a new *.docx file format and the underlying XML vocabulary is WordOpenXML.

    In addition, the way Word handles table styles has changed subtly.

    another factor that's certainly coming into play here is that "custom XML tags" are certainly being removed from these documents when they're opened in Word 2010. Re-writing the Word 2003 XML to Word 2010 OpenXML and stripping the XML noces could be "breaking" the table styles or the links to those styles. I think you'd need to carefully analyze the document's XML after it having been opened in Word 2010 to see what's going on...


    Cindy Meister, VSTO/Word MVP
    Sunday, November 27, 2011 7:51 AM
    Moderator
  • We're already using paragraph styles to control the font settings within the different parts of the table(s), those styles are unaffected and work correctly. We're using the table styles only to control table properties like cell borders, shading, etc. and I don't think that can be replicated with other kinds of styles, or am I wrong there?

    Tobias

     

    Monday, November 28, 2011 9:40 AM
  • Is there any documentation on how the handling of table styles has "changed subtly"?

    The custom XML tags are only ever seen by Word 2003 when we design our "templates". We directly manipulate the XML (outside of Word) to generate our reports. After that step the custom XML tags have been "replaced" and do not remain in the WordML document, so Word 2010 stripping such tags should not have any influence.

    I've inspected the table style properties at various points during our Word automation phase. After opening the file, the tables still have the correct styles assigned. Even after performing the final "save as", the in-memory document still shows our assigned tables styles. However, they are lost in the actual new file created on disk.

    Tobias

     

    Monday, November 28, 2011 10:00 AM
  • I don't use table styles simply because I found them too difficult to consistently control programatically and there's no way that my customer base would ever understand how to use them even if we tried to explain.

    In my applications for table cells that I want to control, I have stuck to using unique Paragraph Styles.

    Take a look at this this thread from September 2011 and maybe it will help you decide what to do in your application.

     http://social.technet.microsoft.com/Forums/en-US/word/thread/5d137988-9bcb-4d26-b17b-33ed2cb2c130 


    Kind Regards, Rich ... http://greatcirclelearning.com
    Thank MIcheal..I have same problem ..your suggestion work for me.
    Monday, November 28, 2011 10:15 AM
  • Hi Tobias

    <<Is there any documentation on how the handling of table styles has "changed subtly"?>>

    Not that I know of. Fact is, table and list styles are no longer included in the tools used to manage styles, as they were in 2003. They're no longer listed in the Styles pane, for instance. This indicates a change of "perception" on the part of the MS team. I don't know what else may have changed "under the covers", specifically.

    I do know that, when a document goes through a conversion process (for example, a 2003 document opened in 2002 or saved to RTF, that kind of thing) that table and list styles will be lost and exhibit the same behavior you describe (formatting is retained).

    So, given what I know, I'd check to what file format these documents are being saved in. You may be assuming it's the docx file format, but perhaps it's not...


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by twolf_chsoft Tuesday, November 29, 2011 10:21 AM
    Monday, November 28, 2011 10:47 AM
    Moderator
  • I do know that, when a document goes through a conversion process (for example, a 2003 document opened in 2002 or saved to RTF, that kind of thing) that table and list styles will be lost and exhibit the same behavior you describe (formatting is retained).

    I just played around with table styles in a completely new document. Indeed, as soon as Word 2010 saves in a non-native format (XML, DOC, and even DOCX with compatibility for previous versions enabled) the table styles are gone.

    And we are of course still using the 2003 formats when saving through automation as we want our code to run with current and older versions of Office. Looks like the next attempt should be to change that to save in a format native to whatever version the client has currently installed.

    Tobias

    Monday, November 28, 2011 2:15 PM
  • Tobias,

    Have you tried opening a source document, select all, copy and then open a new document, in the format you want, and then paste and delete the last empty paragraph?

    Are your table styles then retained?


    Kind Regards, Rich ... http://greatcirclelearning.com
    Monday, November 28, 2011 2:33 PM
  • Hi Tobias

    Word 2003 users can install the Compatibility Pack in order to open *.docx (and related) files. I think that would retain the table styles at that point, but you'd have to test to be sure.

    The CP will also let Word 2003 users save in the same file format.

    It actually makes sense that table styles would be stripped if saving to Word 97-2003 file format, as the older versions of Word can't work with table styles. But I'm surprised Save As will also do it if the file is saved to Word 2007 file format...


    Cindy Meister, VSTO/Word MVP
    Monday, November 28, 2011 3:37 PM
    Moderator
  • "Cindy Meister [MVP]" wrote in message news:752dd8d5-7a0c-4127-9305-0982fff57a51@communitybridge.codeplex.com...
    Fact is, table and list styles are no longer included in the tools used to manage styles, as they were in 2003.
     
    Note that table and list styles are listed in the Manage Styles dialog box and in the Organizer dialog, though.

    Stefan Blom, Microsoft Word MVP
    Monday, November 28, 2011 7:24 PM
  • Hi Stefan

    Yes, and you can create them in the "New styles" dialog box.

    But it does represent a difference in how the team preceives them...


    Cindy Meister, VSTO/Word MVP
    Tuesday, November 29, 2011 9:00 AM
    Moderator
  • "Cindy Meister [MVP]" wrote in message news:54ea6e6f-f92b-43b6-b1e5-8b60f1ee57c1@communitybridge.codeplex.com...
    Hi Stefan
     
    Yes, and you can create them in the "New styles" dialog box.
     
    But it does represent a difference in how the team preceives them...
     
     
     
    Hi Cindy
     
    That is true.
     

    Stefan Blom, Microsoft Word MVP
    Tuesday, November 29, 2011 9:26 AM
  • It actually makes sense that table styles would be stripped if saving to Word 97-2003 file format, as the older versions of Word can't work with table styles. But I'm surprised Save As will also do it if the file is saved to Word 2007 file format...

    I've run a few quick tests saving everything on the automation side with "WdSaveFormat = wdFormatDocumentDefault" so that Office 2003 will still use DOC and Office 2010 DOCX, and to my great delight this seems to resolve our table style problems, at least at the first glance.

    Strangely enough the resulting DOCX seems to be a 2007 version, which didn't work when I ran my manual tests, but at this point I really don't care and am just glad to have found a working solution.

    Thank you for your comments and suggestions.

    Tobias

     

    • Proposed as answer by Digiwise Wednesday, June 27, 2012 5:00 AM
    Tuesday, November 29, 2011 10:18 AM
  • Hi Tobias

    Well, if it continues to work I'll be vastly relieved :-)


    Cindy Meister, VSTO/Word MVP
    Tuesday, November 29, 2011 11:25 AM
    Moderator
  • I just found out that saving to RTF format from Word 2010 (which can be read by older version of Word, therefore also Word 97 or Word 2003 or Word 2007), table style information is retained on re-load of the saved document. The RTF specification includes documented symbols for table styles, as well as XML tags, so you should be able to keep your data intact.

    Regards,

    Christian

    Wednesday, February 12, 2014 11:15 PM