The code below returns some internal style names (or whether) instead of the style names appear on Word's user interface.
public static void main(String[] args) throws Exception {
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new File(args[0]));
MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
Map<String,String > styles = documentPart.getStylesInUse();
for (String styleKey : styles.keySet()) {
String value = styles.get(styleKey);
System.out.println("key <" + styleKey + "> value <" + value + ">");
}
}
I get values as below:
key <berschrift1> value <berschrift1>
key <berschrift3> value <berschrift3>
key <Textkrper> value <Textkrper>
key <berschrift2> value <berschrift2>
key <Blocktext> value <Blocktext>
Instead of I would like get the same what Word also displays for example: Überschrift 1. The information is obviously available in word/styles.xml:
<w:semiHidden/><w:unhideWhenUsed/></w:style><w:style w:type="character" w:customStyle="1" w:styleId="berschrift1Zeichen"><w:name w:val="Überschrift 1 Zeichen"/><w:basedOn w:val="Absatzstandardschriftart"/><w:link w:val="berschrift1"/>
As far as I understand the ID of the style is "berschrift1" and word displays ""Überschrift 1".
How can I get this information pragmatically?
Thanks,
Zsolt