Package org.apache.poi

Examples of org.apache.poi.POIXMLTextExtractor


        Locale locale = context.get(Locale.class, Locale.getDefault());
      
        try {
            OOXMLExtractor extractor;

            POIXMLTextExtractor poiExtractor;
            if(stream instanceof TikaInputStream &&
                  ((TikaInputStream)stream).getOpenContainer() != null) {
               poiExtractor = ExtractorFactory.createExtractor(
                    (OPCPackage)((TikaInputStream)stream).getOpenContainer()
               );
            } else {
               poiExtractor = (POIXMLTextExtractor) ExtractorFactory.createExtractor(stream);
            }
           
            POIXMLDocument document = poiExtractor.getDocument();
            if (document instanceof XSLFSlideShow) {
                extractor = new XSLFPowerPointExtractorDecorator(
                        context, (XSLFPowerPointExtractor) poiExtractor);
            } else if (document instanceof XSSFWorkbook) {
                extractor = new XSSFExcelExtractorDecorator(
View Full Code Here


               return;
            }
            metadata.set(Metadata.CONTENT_TYPE, type.toString());

            // Have the appropriate OOXML text extractor picked
            POIXMLTextExtractor poiExtractor = ExtractorFactory.createExtractor(pkg);
           
            POIXMLDocument document = poiExtractor.getDocument();
            if (poiExtractor instanceof XSSFEventBasedExcelExtractor) {
               extractor = new XSSFExcelExtractorDecorator(
                   context, (XSSFEventBasedExcelExtractor)poiExtractor, locale);
            } else if (document == null) {
               throw new TikaException(
View Full Code Here

    if(args.length < 1) {
      System.err.println("Use:");
      System.err.println("  HXFWordExtractor <filename.docx>");
      System.exit(1);
    }
    POIXMLTextExtractor extractor =
      new XWPFWordExtractor(POIXMLDocument.openPackage(
          args[0]
      ));
    System.out.println(extractor.getText());
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.POIXMLTextExtractor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.