public XWPFWordExtractorDecorator(Metadata metadata, ParseContext context, XWPFWordExtractor extractor) { super(context, extractor); this.metadata = metadata; document = (XWPFDocument) extractor.getDocument(); styles = document.getStyles(); }
public XWPFWordExtractorDecorator(ParseContext context, XWPFWordExtractor extractor) { super(context, extractor); document = (XWPFDocument) extractor.getDocument(); styles = document.getStyles(); }
public XWPFWordExtractorDecorator(Metadata metadata, ParseContext context, XWPFWordExtractor extractor) { super(context, extractor); this.metadata = metadata; document = (XWPFDocument) extractor.getDocument(); styles = document.getStyles(); }
protected XWPFStyle getXWPFStyle( String styleID ) { if ( styleID == null ) return null; else return document.getStyles().getStyle( styleID ); }
protected XWPFStyle getXWPFStyle( String styleID ) { if ( styleID == null ) return null; else return document.getStyles().getStyle( styleID ); }
protected XWPFStyle getXWPFStyle( String styleID ) { if ( styleID == null ) return null; else return document.getStyles().getStyle( styleID ); }
protected XWPFStyle getXWPFStyle( String styleID ) { if ( styleID == null ) return null; else return document.getStyles().getStyle( styleID ); }
protected Style getStyle( String styleID ) { if ( styleID == null ) return getDefaultStyle(); else if ( !document.getStyles().styleExist( styleID ) ) return getDefaultStyle(); // else return stylesMap.get( styleID ); } }
File f=new File("test.docx"); FileInputStream fis = new FileInputStream(f); XWPFDocument xdoc=new XWPFDocument(OPCPackage.open(fis)); XWPFStyles styles=xdoc.getStyles(); List<XWPFParagraph> xwpfparagraphs =xdoc.getParagraphs(); System.out.println(); for(int i=0;i<xwpfparagraphs.size();i++) { System.out.println("paragraph style id "+(i+1)+":"+xwpfparagraphs.get(i).getStyleID()); if(xwpfparagraphs.get(i).getStyleID()!=null) { String styleid=xwpfparagraphs.get(i).getStyleID(); XWPFStyle style=styles.getStyle(styleid); if(style!=null) { System.out.println("Style name:"+style.getName()); if(style.getName().startsWith("heading")) { //this is a heading } } } }
System.out.println(styleID); System.out.println("============================================================="); XWPFStyle xStyle = xdoc.getStyles().getStyle(styleID); if (xStyle.getType() == STStyleType.CHARACTER) { System.out.println(xStyle.getCTStyle());
XWPFStyle style = document.getStyles().getStyle( styleID );
XWPFStyle style = document.getStyles().getStyle( styleID );