List of usage examples for org.apache.poi.xwpf.usermodel XWPFDocument createStyles
public XWPFStyles createStyles()
From source file:org.obeonetwork.m2doc.generator.UserContentRawCopy.java
License:Open Source License
/** * Copy Table Style.//from w w w .j a v a2 s.c o m * * @param inputTable * input Table * @param outputDoc * outputDoc where copy style * @throws IOException * if the copy fails */ private static void copyTableStyle(XWPFTable inputTable, XWPFDocument outputDoc) throws IOException { try (XWPFDocument inputDoc = inputTable.getBody().getXWPFDocument();) { XWPFStyle style = inputDoc.getStyles().getStyle(inputTable.getStyleID()); if (outputDoc == null || style == null) { return; } if (outputDoc.getStyles() == null) { outputDoc.createStyles(); } List<XWPFStyle> usedStyleList = inputDoc.getStyles().getUsedStyleList(style); for (XWPFStyle xwpfStyle : usedStyleList) { outputDoc.getStyles().addStyle(xwpfStyle); } } }