List of usage examples for org.apache.poi.hssf.extractor ExcelExtractor getSummaryInformation
public SummaryInformation getSummaryInformation()
From source file:com.frameworkset.platform.cms.searchmanager.extractors.CmsExtractorMsExcel.java
License:Open Source License
/** * ?excel2003 /* w ww .ja v a 2s. c o m*/ * @param path * @return * @throws IOException */ public String readExcel(InputStream in) throws IOException { String content = null; try { HSSFWorkbook wb = new HSSFWorkbook(in); ExcelExtractor extractor = new ExcelExtractor(wb); extractor.setFormulasNotResults(true); extractor.setIncludeSheetNames(false); content = extractor.getText(); this.m_documentSummary = extractor.getDocSummaryInformation(); this.m_summary = extractor.getSummaryInformation(); } catch (FileNotFoundException e) { e.printStackTrace(); } return content; }
From source file:com.jaeksoft.searchlib.parser.XlsParser.java
License:Open Source License
@Override protected void parseContent(StreamLimiter streamLimiter, LanguageEnum lang) throws IOException { HSSFWorkbook workbook = new HSSFWorkbook(streamLimiter.getNewInputStream()); ExcelExtractor excel = null; try {// www .j av a 2s . c o m excel = new ExcelExtractor(workbook); ParserResultItem result = getNewParserResultItem(); SummaryInformation info = excel.getSummaryInformation(); if (info != null) { result.addField(ParserFieldEnum.title, info.getTitle()); result.addField(ParserFieldEnum.author, info.getAuthor()); result.addField(ParserFieldEnum.subject, info.getSubject()); } String content = excel.getText(); result.addField(ParserFieldEnum.content, StringUtils.replaceConsecutiveSpaces(content, " ")); result.langDetection(10000, ParserFieldEnum.content); } finally { IOUtils.close(excel); } }
From source file:com.opensearchserver.extractor.parser.Xls.java
License:Apache License
@Override protected void parseContent(InputStream inputStream, String extension, String mimeType) throws Exception { HSSFWorkbook workbook = new HSSFWorkbook(inputStream); ExcelExtractor excel = null; try {//from ww w.j a v a 2s.c o m excel = new ExcelExtractor(workbook); SummaryInformation info = excel.getSummaryInformation(); if (info != null) { metas.add(TITLE, info.getTitle()); metas.add(AUTHOR, info.getAuthor()); metas.add(SUBJECT, info.getSubject()); metas.add(CREATION_DATE, info.getCreateDateTime()); metas.add(MODIFICATION_DATE, info.getLastSaveDateTime()); metas.add(KEYWORDS, info.getKeywords()); } ParserDocument result = getNewParserDocument(); result.add(CONTENT, excel.getText()); result.add(LANG_DETECTION, languageDetection(CONTENT, 10000)); } finally { if (excel != null) IOUtils.closeQuietly(excel); } }
From source file:com.opensearchserver.textextractor.parser.Xls.java
License:Apache License
@Override protected void parseContent(InputStream inputStream) throws Exception { HSSFWorkbook workbook = new HSSFWorkbook(inputStream); ExcelExtractor excel = null; try {//from w w w .j a v a2 s . com excel = new ExcelExtractor(workbook); SummaryInformation info = excel.getSummaryInformation(); if (info != null) { metas.add(TITLE, info.getTitle()); metas.add(AUTHOR, info.getAuthor()); metas.add(SUBJECT, info.getSubject()); metas.add(CREATION_DATE, info.getCreateDateTime()); metas.add(MODIFICATION_DATE, info.getLastSaveDateTime()); metas.add(KEYWORDS, info.getKeywords()); } ParserDocument result = getNewParserDocument(); result.add(CONTENT, excel.getText()); result.add(LANG_DETECTION, languageDetection(CONTENT, 10000)); } finally { if (excel != null) IOUtils.closeQuietly(excel); } }