Package org.apache.poi.xssf.extractor

Examples of org.apache.poi.xssf.extractor.XSSFExcelExtractor


    OPCPackage pkg = OPCPackage.open(
        (new File(dirname, "ExcelWithAttachments.xlsx")).toString()
    );
    XSSFWorkbook wb = new XSSFWorkbook(pkg);

    XSSFExcelExtractor ext = new XSSFExcelExtractor(wb);
    POIXMLPropertiesTextExtractor textExt = ext.getMetadataTextExtractor();
   
    // Check basics
    assertNotNull(textExt);
    assertTrue(textExt.getText().length() > 0);
   
View Full Code Here


      throw new IllegalArgumentException("Invalid OOXML Package received - expected 1 core document, found " + core.size());
    }
   
    PackagePart corePart = pkg.getPart(core.getRelationship(0));
    if(corePart.getContentType().equals(XSSFRelation.WORKBOOK.getContentType())) {
      return new XSSFExcelExtractor(pkg);
    }
    if(corePart.getContentType().equals(XWPFRelation.DOCUMENT.getContentType())) {
      return new XWPFWordExtractor(pkg);
    }
    if(corePart.getContentType().equals(XSLFSlideShow.MAIN_CONTENT_TYPE)) {
View Full Code Here

        if (corePart.getContentType().equals(XSSFRelation.WORKBOOK.getContentType()) ||
            corePart.getContentType().equals(XSSFRelation.MACRO_TEMPLATE_WORKBOOK.getContentType()) ||
            corePart.getContentType().equals(XSSFRelation.MACRO_ADDIN_WORKBOOK.getContentType()) ||
            corePart.getContentType().equals(XSSFRelation.TEMPLATE_WORKBOOK.getContentType()) ||
            corePart.getContentType().equals(XSSFRelation.MACROS_WORKBOOK.getContentType())) {
            return new XSSFExcelExtractor(pkg);
        }

        if(corePart.getContentType().equals(XWPFRelation.DOCUMENT.getContentType()) ||
            corePart.getContentType().equals(XWPFRelation.TEMPLATE.getContentType()) ||
            corePart.getContentType().equals(XWPFRelation.MACRO_DOCUMENT.getContentType()) ||
View Full Code Here

  public void testGetFromMainExtractor() throws Exception {
    OPCPackage pkg = PackageHelper.open(_ssSamples.openResourceAsStream("ExcelWithAttachments.xlsm"));

    XSSFWorkbook wb = new XSSFWorkbook(pkg);

    XSSFExcelExtractor ext = new XSSFExcelExtractor(wb);
    POIXMLPropertiesTextExtractor textExt = ext.getMetadataTextExtractor();

    // Check basics
    assertNotNull(textExt);
    assertTrue(textExt.getText().length() > 0);

    // Check some of the content
    String text = textExt.getText();
    String cText = textExt.getCorePropertiesText();

    assertTrue(text.contains("LastModifiedBy = Yury Batrakov"));
    assertTrue(cText.contains("LastModifiedBy = Yury Batrakov"));
   
    textExt.close();
    ext.close();
  }
View Full Code Here

          if(corePart.getContentType().equals(rel.getContentType())) {
             if(getPreferEventExtractor()) {
                return new XSSFEventBasedExcelExtractor(pkg);
             }

             return new XSSFExcelExtractor(pkg);
          }
       }

       // Is it XWPF?
       for(XWPFRelation rel : XWPFWordExtractor.SUPPORTED_TYPES) {
View Full Code Here

    org.apache.poi.openxml4j.opc.Package pkg = Package.open(
        (new File(dirname, "ExcelWithAttachments.xlsx")).toString()
    );
    XSSFWorkbook wb = new XSSFWorkbook(pkg);

    XSSFExcelExtractor ext = new XSSFExcelExtractor(wb);
    POIXMLPropertiesTextExtractor textExt = ext.getMetadataTextExtractor();
   
    // Check basics
    assertNotNull(textExt);
    assertTrue(textExt.getText().length() > 0);
   
View Full Code Here

      throw new IllegalArgumentException("Invalid OOXML Package received - expected 1 core document, found " + core.size());
    }
   
    PackagePart corePart = pkg.getPart(core.getRelationship(0));
    if(corePart.getContentType().equals(XSSFRelation.WORKBOOK.getContentType())) {
      return new XSSFExcelExtractor(pkg);
    }
    if(corePart.getContentType().equals(XWPFRelation.DOCUMENT.getContentType())) {
      return new XWPFWordExtractor(pkg);
    }
    if(corePart.getContentType().equals(XSLFSlideShow.MAIN_CONTENT_TYPE)) {
View Full Code Here

  public void testGetFromMainExtractor() throws Exception {
    OPCPackage pkg = PackageHelper.open(_ssSamples.openResourceAsStream("ExcelWithAttachments.xlsm"));

    XSSFWorkbook wb = new XSSFWorkbook(pkg);

    XSSFExcelExtractor ext = new XSSFExcelExtractor(wb);
    POIXMLPropertiesTextExtractor textExt = ext.getMetadataTextExtractor();

    // Check basics
    assertNotNull(textExt);
    assertTrue(textExt.getText().length() > 0);
View Full Code Here

        if (corePart.getContentType().equals(XSSFRelation.WORKBOOK.getContentType()) ||
            corePart.getContentType().equals(XSSFRelation.MACRO_TEMPLATE_WORKBOOK.getContentType()) ||
            corePart.getContentType().equals(XSSFRelation.MACRO_ADDIN_WORKBOOK.getContentType()) ||
            corePart.getContentType().equals(XSSFRelation.TEMPLATE_WORKBOOK.getContentType()) ||
            corePart.getContentType().equals(XSSFRelation.MACROS_WORKBOOK.getContentType())) {
            return new XSSFExcelExtractor(pkg);
        }

        if(corePart.getContentType().equals(XWPFRelation.DOCUMENT.getContentType()) ||
            corePart.getContentType().equals(XWPFRelation.TEMPLATE.getContentType()) ||
            corePart.getContentType().equals(XWPFRelation.MACRO_DOCUMENT.getContentType()) ||
View Full Code Here

            corePart.getContentType().equals(XSSFRelation.TEMPLATE_WORKBOOK.getContentType()) ||
            corePart.getContentType().equals(XSSFRelation.MACROS_WORKBOOK.getContentType())) {
           if(getPreferEventExtractor()) {
              return new XSSFEventBasedExcelExtractor(pkg);
           } else {
              return new XSSFExcelExtractor(pkg);
           }
        }

        if(corePart.getContentType().equals(XWPFRelation.DOCUMENT.getContentType()) ||
            corePart.getContentType().equals(XWPFRelation.TEMPLATE.getContentType()) ||
View Full Code Here

TOP

Related Classes of org.apache.poi.xssf.extractor.XSSFExcelExtractor

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.