Example usage for org.apache.poi.extractor POITextExtractor getText

List of usage examples for org.apache.poi.extractor POITextExtractor getText

Introduction

In this page you can find the example usage for org.apache.poi.extractor POITextExtractor getText.

Prototype

public abstract String getText();

Source Link

Document

Retrieves all the text from the document.

Usage

From source file:com.stimulus.archiva.extraction.POIExtractor.java

License:Open Source License

public Reader getText(InputStream is, Charset charset, IndexInfo indexInfo) throws ExtractionException {
    try {//w ww. ja v a  2  s.c  om
        POITextExtractor poiExtractor = ExtractorFactory.createExtractor(is);
        String text = poiExtractor.getText();
        poiExtractor = null;
        Reader outReader = new StringReader(text);
        indexInfo.addReader(outReader);
        return outReader;
    } catch (Throwable e) {
        throw new ExtractionException("failed to extract text from document:" + e.getMessage(), e, logger);
    }
}

From source file:org.wandora.utils.MSOfficeBox.java

License:Open Source License

public static String getText(InputStream is) {
    try {//from  ww w .j  a v  a2s  .  com
        POITextExtractor extractor = ExtractorFactory.createExtractor(is);
        return extractor.getText();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:org.wandora.utils.MSOfficeBox.java

License:Open Source License

public static String getText(File f) {
    try {// w w  w .  j  ava  2s.c  o  m
        POITextExtractor extractor = ExtractorFactory.createExtractor(f);
        return extractor.getText();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}