Example usage for org.apache.poi.xssf.extractor XSSFExcelExtractor setIncludeCellComments

List of usage examples for org.apache.poi.xssf.extractor XSSFExcelExtractor setIncludeCellComments

Introduction

In this page you can find the example usage for org.apache.poi.xssf.extractor XSSFExcelExtractor setIncludeCellComments.

Prototype

public void setIncludeCellComments(boolean includeCellComments) 

Source Link

Document

Should cell comments be included?

Usage

From source file:com.jaeksoft.searchlib.parser.XlsxParser.java

License:Open Source License

@Override
protected void parseContent(StreamLimiter streamLimiter, LanguageEnum lang) throws IOException {

    XSSFWorkbook workbook = new XSSFWorkbook(streamLimiter.getNewInputStream());
    XSSFExcelExtractor excelExtractor = null;
    try {/*from  ww  w . j a  va2 s.  c o m*/
        excelExtractor = new XSSFExcelExtractor(workbook);
        ParserResultItem result = getNewParserResultItem();

        CoreProperties info = excelExtractor.getCoreProperties();
        if (info != null) {
            result.addField(ParserFieldEnum.title, info.getTitle());
            result.addField(ParserFieldEnum.creator, info.getCreator());
            result.addField(ParserFieldEnum.subject, info.getSubject());
            result.addField(ParserFieldEnum.description, info.getDescription());
            result.addField(ParserFieldEnum.keywords, info.getKeywords());
        }

        excelExtractor.setIncludeCellComments(true);
        excelExtractor.setIncludeHeadersFooters(true);
        excelExtractor.setIncludeSheetNames(true);
        String content = excelExtractor.getText();
        result.addField(ParserFieldEnum.content, StringUtils.replaceConsecutiveSpaces(content, " "));

        result.langDetection(10000, ParserFieldEnum.content);
    } finally {
        IOUtils.close(excelExtractor);
    }

}

From source file:com.opensearchserver.extractor.parser.Xlsx.java

License:Apache License

@Override
protected void parseContent(InputStream inputStream, String extension, String mimeType) throws Exception {

    XSSFWorkbook workbook = null;//from w  w w. j  ava 2 s  . c  o m
    XSSFExcelExtractor excelExtractor = null;
    try {
        workbook = new XSSFWorkbook(inputStream);
        excelExtractor = new XSSFExcelExtractor(workbook);

        CoreProperties info = excelExtractor.getCoreProperties();
        if (info != null) {
            metas.add(TITLE, info.getTitle());
            metas.add(CREATOR, info.getCreator());
            metas.add(CREATION_DATE, info.getCreated());
            metas.add(MODIFICATION_DATE, info.getModified());
            metas.add(SUBJECT, info.getSubject());
            metas.add(DESCRIPTION, info.getDescription());
            metas.add(KEYWORDS, info.getKeywords());
        }

        ParserDocument result = getNewParserDocument();
        excelExtractor.setIncludeCellComments(true);
        excelExtractor.setIncludeHeadersFooters(true);
        excelExtractor.setIncludeSheetNames(true);
        result.add(CONTENT, excelExtractor.getText());
        result.add(LANG_DETECTION, languageDetection(CONTENT, 10000));

    } finally {
        if (excelExtractor != null)
            IOUtils.closeQuietly(excelExtractor);
        if (workbook != null)
            IOUtils.closeQuietly(workbook);
    }

}

From source file:com.opensearchserver.textextractor.parser.Xlsx.java

License:Apache License

private void parseContent(XSSFWorkbook workbook) throws Exception {

    XSSFExcelExtractor excelExtractor = null;
    try {/* ww  w . j  a  v  a2  s.c  om*/
        excelExtractor = new XSSFExcelExtractor(workbook);

        CoreProperties info = excelExtractor.getCoreProperties();
        if (info != null) {
            metas.add(TITLE, info.getTitle());
            metas.add(CREATOR, info.getCreator());
            metas.add(CREATION_DATE, info.getCreated());
            metas.add(MODIFICATION_DATE, info.getModified());
            metas.add(SUBJECT, info.getSubject());
            metas.add(DESCRIPTION, info.getDescription());
            metas.add(KEYWORDS, info.getKeywords());
        }

        ParserDocument result = getNewParserDocument();
        excelExtractor.setIncludeCellComments(true);
        excelExtractor.setIncludeHeadersFooters(true);
        excelExtractor.setIncludeSheetNames(true);
        result.add(CONTENT, excelExtractor.getText());
        result.add(LANG_DETECTION, languageDetection(CONTENT, 10000));

    } finally {
        if (excelExtractor != null)
            IOUtils.closeQuietly(excelExtractor);
    }

}