Reputation: 61
Micro: I want to see a list of the Style names and their characteristics from Word template/Style Set.
Macro: Other people in my office have defined Style Sets and Templates with a wide variety of formatting. Short of opening a document, applying the styles, and using Style Inspector for each style, is there a way to see what the Style definition includes, so I can decide whether to try and tweak the Style, or scrap it and start from scratch?
I'm using Word 2010, on Windows 7.
The Desktop Support Team has defined a Style Set called Company IT Style that is pushed out to every user on the network through the user's templates folder.
C:\Users\%MyName%\AppData\Roaming\Microsoft\QuickStyles\Company IT QuickStyle Set.dotx
I would like to export a list of the names of the styles included in this style set, along with the definitions/characteristics of each style, such as is revealed using the Modify Style button in the Styles list.
For example:
Normal:
Font: (Default) Times New Roman, 11 pt, Left
Line spacing: single, Space After: 6 pt, Widow/Orphan control, Style: Quick Style
Heading1:
Font: Arial Black, 16 pt, Indent:
Left: 0"
Hanging: 0.3", Space
Before: 18 pt, After: 18 pt, Keep with next, Level 1
Tab stops: 0.3", List tab, Outline numbered + Level: 1 + Numbering Style: 1, 2, 3, … + Start at: 1 + Alignment: Left + Aligned at: 0" + Tab after: 0.3" + Indent at: 0.3", Style: Linked, Quick Style
Based on: Normal
Following style: Normal
There’s a macro at the Word Tips newsletter site that will reveal Template settings (PaperSize, Orientation, etc.) but I don’t know how to tweak that to reveal Style formatting characteristics.
http://word.tips.net/T010117_Listing_the_Settings_in_a_Template.html
I'm looking for a way to export the information from a given Style Set, ideally to a Word table that would show the Style name (formatted in that style), followed by a structured list of the elements of that style. Or even better, to XML.
Is there a ready-made tool to do this?
I'm a semi-power user of Word - probably the most advanced user in my department, but not an expert by any means. I can handle macros, but VBA often leaves me befuddled.
Any help or pointers appreciated.
James
edit: Suzanne Barnhill, an MSMVP, partially answered my question with this:
"The simple answer is that you can print this information by selecting “Styles” under “Properties” in >the Print All Pages dropdown on the Print tab of the backstage. To “print” this as a document, you can >print it to the Microsoft XPS Document Writer or to a PDF printer."
However, this yields only those styles actively in use in the document. As some of the templates and style sets I want to examine are extensive, I'd rather not have to create a document and assign each style to a paragraph or character.
Upvotes: 3
Views: 7710
Reputation: 11
1.Change the extension of your document to .zip so MyTemplate.docx becomes MyTemplate.zip
2.Open the zip file
3.In the 'word' folder there is a file called styles.xml which contains all styles and it's settings. You can open it with Excel (as an XML table) to view it in a table format.
(there is also a file called stylesWithEffects.xml it's mostly the same but there still is a difference, I didn't check what exactly is different).
The challenge though is that many columns have names like val17, val18 etc so it's not always clear what the value means.
Hope this helps JP
Upvotes: 1
Reputation: 61
Presented so others with the same question can use the answer.....
As mentioned in the OP, I'm using Word 2010 on Windows 7.
The "Print What" dropdown in the File->Print dialog offers the "Print Styles" option, but that only prints the definitions for the styles actively in use in that document.
I was provided the following macro, which works in Word 2007 and 2010. As the author, Jessica Weissman, says,
"Here's a macro I use in Word 2007 to list the descriptions of all paragraph and character styles in a document. It skips table styles and list styles. It lists all styles in the document, including those not in use.
If a style is based on another style, the description of the style includes only those things that differ from the base style. Fortunately the base style is one of the items in a style description.
If you want to see all styles of all types, comment out the If statement and the End If statement.
Caveats: it hasn't been stress tested and comes purely as is with no guarantees.
Macro code follows - it's simpler than I thought.
Sub describeAllStylesWeCareAbout()
' by Jessica Weissman
Dim docActive As Document
Dim docNew As Document
Dim styleLoop As Style
Set docActive = ActiveDocument
Set docNew = Documents.Add
For Each styleLoop In docActive.Styles
If styleLoop.Type < 3 Then
' show only character and paragraph styles, not list or table styles
With docNew.Range
.InsertAfter Text:=styleLoop.NameLocal & Chr(9) _
& styleLoop.Description
.InsertParagraphAfter
.InsertParagraphAfter
End With
End If
Next styleLoop
End Sub
Upvotes: 3