I\'m trying to get the style information from an MS docx file, I have no problem writing file content with added styles like bold, italic. font size etc, but reading the fil
I found a very nice way to copy styles from one document to another. It is not as direct as I would have hoped but it works.
Copy the styles into your output document with the following code
public void copyStylesXml(String stylesXmlString) {
try {
CTStyles ctStyle = CTStyles.Factory.parse(stylesXmlString);
XWPFStyles styles = getDoc().createStyles();
styles.setStyles(ctStyle);
} catch (Exception e) {
log.warn(e, e);
}
}
The same approach works for copying list formats