/** * Sets the ctStyles * * @param styles */ public void setStyles(CTStyles styles) { ctStyles = styles; // Build up all the style objects for (CTStyle style : ctStyles.getStyleArray()) { listStyle.add(new XWPFStyle(style, this)); } if (ctStyles.isSetDocDefaults()) { CTDocDefaults docDefaults = ctStyles.getDocDefaults(); if (docDefaults.isSetRPrDefault() && docDefaults.getRPrDefault().isSetRPr()) { defaultRunStyle = new XWPFDefaultRunStyle( docDefaults.getRPrDefault().getRPr()); } if (docDefaults.isSetPPrDefault() && docDefaults.getPPrDefault().isSetPPr()) { defaultParaStyle = new XWPFDefaultParagraphStyle( docDefaults.getPPrDefault().getPPr()); } } }
/** * Read document */ @Override protected void onDocumentRead() throws IOException{ StylesDocument stylesDoc; try { InputStream is = getPackagePart().getInputStream(); stylesDoc = StylesDocument.Factory.parse(is); ctStyles = stylesDoc.getStyles(); latentStyles = new XWPFLatentStyles(ctStyles.getLatentStyles(), this); } catch (XmlException e) { throw new POIXMLException("Unable to read styles", e); } // Build up all the style objects for(CTStyle style : ctStyles.getStyleList()) { listStyle.add(new XWPFStyle(style, this)); } }
/** * Sets the ctStyles * * @param styles */ public void setStyles(CTStyles styles) { ctStyles = styles; // Build up all the style objects for (CTStyle style : ctStyles.getStyleArray()) { listStyle.add(new XWPFStyle(style, this)); } if (ctStyles.isSetDocDefaults()) { CTDocDefaults docDefaults = ctStyles.getDocDefaults(); if (docDefaults.isSetRPrDefault() && docDefaults.getRPrDefault().isSetRPr()) { defaultRunStyle = new XWPFDefaultRunStyle( docDefaults.getRPrDefault().getRPr()); } if (docDefaults.isSetPPrDefault() && docDefaults.getPPrDefault().isSetPPr()) { defaultParaStyle = new XWPFDefaultParagraphStyle( docDefaults.getPPrDefault().getPPr()); } } }