Reputation: 333
I have been searching for all the default styles in MS Word.
For some particular styles I noticed that the style name is different in MS Word Application UI and in OOXML.
e.g. insert some comment in Word document the style w:styleId="CommentText" is being populated in styles.xml. The name of this style in styles.xml is 'annotation text' while in application no style with this name is present (although style with name Comment Text is present in Applciation UI).
I searched for some mapping of annotation text style with Comment Text style but I didn't noticed any mapping.
Same scenario is replicable for header and footer style.
Name of these styles in Application are 'Header' and Footer respectively (name with capital first letter).
I am trying to know how to map the style name in styles.xml with name in the application UI.
Upvotes: 1
Views: 213
Reputation: 176259
If you want to know the mapping of the names of the built-in styles to the style id used in Open XML you can create a sample document containing all the built-in styles and then check the Open XML of that file.
This macro will create a document with all built-in paragraph styles:
Sub CreateDocWithBuiltinStyles()
Dim style As style
Dim doc As Document
Dim rng As Range
Set doc = Application.Documents.Add
Set rng = doc.Range
For Each style In doc.Styles
If style.BuiltIn And _
(style.Type = wdStyleTypeParagraph Or _
style.Type = wdStyleTypeLinked Or _
style.Type = wdStyleTypeCharacter Or _
style.Type = wdStyleTypeParagraphOnly) Then
Set rng = doc.Range
rng.Collapse wdCollapseEnd
rng.style = style
rng.Text = style.NameLocal & vbCrLf
End If
Next
End Sub
You then have to examine the document.xml file in the generated package and you can easily see what display name belongs to what style id.
Upvotes: 3