Examples of XWPFWordExtractor


Examples of org.apache.poi.xwpf.extractor.XWPFWordExtractor

           Exception {
       InputStream is = new FileInputStream(file);
       String bodyText = null;
       try {
           XWPFDocument wd = new XWPFDocument(is);
           XWPFWordExtractor wde = new XWPFWordExtractor(wd);
           bodyText = wde.getText();
       } catch (Exception e) {
           log.debug(e);
       }
       Document doc = SearchUtils.addFields(file, bodyText);
       return doc;
View Full Code Here

Examples of org.apache.poi.xwpf.extractor.XWPFWordExtractor

        final String filename = file.getName();
        String contentText = "";
        AttachmentIndex attachmentIndexBean = new AttachmentIndex();
        log.debug("Creating attachment document type --> "+fileExtension);
        if ("docx".equals(fileExtension)) {
            XWPFWordExtractor parserDoc;
            try {
                //1- Parsear word Document
                parserDoc = IndexerFile.parseWordDocument(file);
                //2- Extract word document content
                contentText = IndexerFile.extractContentWordDocument(parserDoc);
View Full Code Here

Examples of org.apache.poi.xwpf.extractor.XWPFWordExtractor

     * @throws POIXMLException
     * @throws Exception
     */
    public static XWPFWordExtractor parseWordDocument(final File file) throws POIXMLException, Exception {
        InputStream is = new FileInputStream(file);
        XWPFWordExtractor wde = null;
        try {
            XWPFDocument wd = new XWPFDocument(is);
            wde = new XWPFWordExtractor(wd);
            log.debug("Parse Word Document --------------------------> ");
        } catch (Exception e) {
            log.error("ERROR parse Word Document-------->"+ e);
        }
    return wde;
View Full Code Here

Examples of org.apache.poi.xwpf.extractor.XWPFWordExtractor

    public DocXReport(InputStream inputStream) throws Exception {
        if (inputStream == null) {
            throw new Exception("Source file (Inputstream) is null.");
        }
        document = new XWPFDocument(inputStream);
        extractor = new XWPFWordExtractor(document);
    }
View Full Code Here

Examples of org.apache.poi.xwpf.extractor.XWPFWordExtractor

    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)) {
      return new XSLFPowerPointExtractor(pkg);
    }
    throw new IllegalArgumentException("No supported documents found in the OOXML package");
View Full Code Here

Examples of org.apache.poi.xwpf.extractor.XWPFWordExtractor

         catch (OpenXML4JRuntimeException e)
         {
            throw new DocumentReadException("Can't open message.", e);
         }

         final XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
         text = SecurityHelper.doPrivilegedAction(new PrivilegedAction<String>()
         {
            public String run()
            {
               return extractor.getText();
            }
         });
      }
      finally
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.