You can find the styles in the StyleDefinitionPart of your MainDocumentPart. Just adept the following code:
Using java Syntax Highlighting
WordprocessingMLPackage
wml = WordprocessingMLPackage.
load(new File("XYZ.docx"));
Styles s
= wml.
getMainDocumentPart().
getStyleDefinitionsPart().
getJaxbElement();
for (Style style
: styles.
getStyle()) {
if(style.
getName.
getVal().
equals("Normal") {
// ...
}
if(style.
getName.
getVal().
equals("heading 1") {
// ...
}
// prints the name of every style found in the document
System.
out.
println(style.
getName().
getVal());
}
Parsed in 0.014 seconds, using
GeSHi 1.0.8.4
In those styles you can find the formating by loading der RPr object, which contains information about font, fontsize, etc.:
Using java Syntax Highlighting
RPr properties
= style.
getRPr();
Parsed in 0.013 seconds, using
GeSHi 1.0.8.4