Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
What Is poi-5.2.3.jar?
What Is poi-5.2.3.jar?
✍: FYIcenter.com
poi-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which
provides an API for Microsoft document files of Word, Excel, PowerPoint, and Visio.
poi-5.2.3.jar supports Apache POI components that read and write Microsoft's OLE 2 Compound document format, which is used in early versions of Microsoft Office tools like Word 97, Excel 97, PowerPoint 97, etc.
poi-5.2.3.jar is distributed as part of the poi-bin-5.2.3-20220909.zip download file.
JAR File Size and Download Location:
JAR name: poi-5.2.3.jar Target JDK version: 9 File name: poi.jar, poi-5.2.3.jar File size: 2964641 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-5.2.3.jar:
⏎ org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java
/* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ package org.apache.poi.hssf.extractor; import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.poi.POIDocument; import org.apache.poi.extractor.POIOLE2TextExtractor; import org.apache.poi.hpsf.DocumentSummaryInformation; import org.apache.poi.hpsf.SummaryInformation; import org.apache.poi.hssf.eventusermodel.FormatTrackingHSSFListener; import org.apache.poi.hssf.eventusermodel.HSSFEventFactory; import org.apache.poi.hssf.eventusermodel.HSSFListener; import org.apache.poi.hssf.eventusermodel.HSSFRequest; import org.apache.poi.hssf.model.HSSFFormulaParser; import org.apache.poi.hssf.record.BOFRecord; import org.apache.poi.hssf.record.BoundSheetRecord; import org.apache.poi.hssf.record.FormulaRecord; import org.apache.poi.hssf.record.LabelRecord; import org.apache.poi.hssf.record.LabelSSTRecord; import org.apache.poi.hssf.record.NoteRecord; import org.apache.poi.hssf.record.NumberRecord; import org.apache.poi.hssf.record.SSTRecord; import org.apache.poi.hssf.record.StringRecord; import org.apache.poi.poifs.filesystem.DirectoryEntry; import org.apache.poi.poifs.filesystem.DirectoryNode; import org.apache.poi.poifs.filesystem.POIFSFileSystem; /** * A text extractor for Excel files, that is based * on the HSSF EventUserModel API. * It will typically use less memory than * {@link ExcelExtractor}, but may not provide * the same richness of formatting. * Returns the textual content of the file, suitable for * indexing by something like Lucene, but not really * intended for display to the user. * <p> * To turn an excel file into a CSV or similar, then see * the XLS2CSVmra example * </p> * * @see <a href="http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java">XLS2CSVmra</a> */ public class EventBasedExcelExtractor implements POIOLE2TextExtractor, org.apache.poi.ss.extractor.ExcelExtractor { private final POIFSFileSystem poifs; private final DirectoryNode _dir; private boolean doCloseFilesystem = true; boolean _includeSheetNames = true; boolean _formulasNotResults; public EventBasedExcelExtractor(DirectoryNode dir) { poifs = null; _dir = dir; } public EventBasedExcelExtractor(POIFSFileSystem fs) { poifs = fs; _dir = fs.getRoot(); } /** * Would return the document information metadata for the document, * if we supported it */ @Override public DocumentSummaryInformation getDocSummaryInformation() { throw new IllegalStateException("Metadata extraction not supported in streaming mode, please use ExcelExtractor"); } /** * Would return the summary information metadata for the document, * if we supported it */ @Override public SummaryInformation getSummaryInformation() { throw new IllegalStateException("Metadata extraction not supported in streaming mode, please use ExcelExtractor"); } /** * Would control the inclusion of cell comments from the document, * if we supported it */ public void setIncludeCellComments(boolean includeComments) { throw new IllegalStateException("Comment extraction not supported in streaming mode, please use ExcelExtractor"); } /** * Would control the inclusion of headers and footers from the document, * if we supported it */ public void setIncludeHeadersFooters(boolean includeHeadersFooters) { throw new IllegalStateException("Header/Footer extraction not supported in streaming mode, please use ExcelExtractor"); } /** * Should sheet names be included? Default is true */ public void setIncludeSheetNames(boolean includeSheetNames) { _includeSheetNames = includeSheetNames; } /** * Should we return the formula itself, and not * the result it produces? Default is false */ public void setFormulasNotResults(boolean formulasNotResults) { _formulasNotResults = formulasNotResults; } /** * Retreives the text contents of the file */ public String getText() { String text; try { TextListener tl = triggerExtraction(); text = tl._text.toString(); if(! text.endsWith("\n")) { text = text + "\n"; } } catch(IOException e) { throw new RuntimeException(e); } return text; } private TextListener triggerExtraction() throws IOException { TextListener tl = new TextListener(); FormatTrackingHSSFListener ft = new FormatTrackingHSSFListener(tl); tl._ft = ft; // Register and process HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); request.addListenerForAllRecords(ft); factory.processWorkbookEvents(request, _dir); return tl; } private class TextListener implements HSSFListener { FormatTrackingHSSFListener _ft; private SSTRecord sstRecord; private final List<String> sheetNames; final StringBuilder _text = new StringBuilder(); private int sheetNum = -1; private int rowNum; private boolean outputNextStringValue; private int nextRow = -1; public TextListener() { sheetNames = new ArrayList<>(); } public void processRecord(org.apache.poi.hssf.record.Record record) { String thisText = null; int thisRow = -1; switch(record.getSid()) { case BoundSheetRecord.sid: BoundSheetRecord sr = (BoundSheetRecord)record; sheetNames.add(sr.getSheetname()); break; case BOFRecord.sid: BOFRecord bof = (BOFRecord)record; if(bof.getType() == BOFRecord.TYPE_WORKSHEET) { sheetNum++; rowNum = -1; if(_includeSheetNames) { if(_text.length() > 0) _text.append("\n"); _text.append(sheetNames.get(sheetNum)); } } break; case SSTRecord.sid: sstRecord = (SSTRecord)record; break; case FormulaRecord.sid: FormulaRecord frec = (FormulaRecord) record; thisRow = frec.getRow(); if(_formulasNotResults) { thisText = HSSFFormulaParser.toFormulaString(null, frec.getParsedExpression()); } else { if(frec.hasCachedResultString()) { // Formula result is a string // This is stored in the next record outputNextStringValue = true; nextRow = frec.getRow(); } else { thisText = _ft.formatNumberDateCell(frec); } } break; case StringRecord.sid: if(outputNextStringValue) { // String for formula StringRecord srec = (StringRecord)record; thisText = srec.getString(); thisRow = nextRow; outputNextStringValue = false; } break; case LabelRecord.sid: LabelRecord lrec = (LabelRecord) record; thisRow = lrec.getRow(); thisText = lrec.getValue(); break; case LabelSSTRecord.sid: LabelSSTRecord lsrec = (LabelSSTRecord) record; thisRow = lsrec.getRow(); if(sstRecord == null) { throw new IllegalStateException("No SST record found"); } thisText = sstRecord.getString(lsrec.getSSTIndex()).toString(); break; case NoteRecord.sid: NoteRecord nrec = (NoteRecord) record; thisRow = nrec.getRow(); // TODO: Find object to match nrec.getShapeId() break; case NumberRecord.sid: NumberRecord numrec = (NumberRecord) record; thisRow = numrec.getRow(); thisText = _ft.formatNumberDateCell(numrec); break; default: break; } if(thisText != null) { if(thisRow != rowNum) { rowNum = thisRow; if(_text.length() > 0) _text.append("\n"); } else { _text.append("\t"); } _text.append(thisText); } } } @Override public void setCloseFilesystem(boolean doCloseFilesystem) { this.doCloseFilesystem = doCloseFilesystem; } @Override public boolean isCloseFilesystem() { return doCloseFilesystem; } @Override public Closeable getFilesystem() { return poifs; } @Override public POIDocument getDocument() { return null; } @Override public DirectoryEntry getRoot() { return _dir; } @Override public void close() throws IOException { // first perform the default close POIOLE2TextExtractor.super.close(); // also ensure that an underlying DirectoryNode // is closed properly to avoid leaking file-handles DirectoryEntry root = getRoot(); if (root instanceof DirectoryNode) { Closeable fs = ((DirectoryNode) root).getFileSystem(); if (isCloseFilesystem() && fs != null) { fs.close(); } } } }
⏎ org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java
Or download all of them as a single archive file:
File name: poi-5.2.3-src.zip File size: 2479830 bytes Release date: 2022-09-09 Download
⇒ What Is poi-ooxml-5.2.3.jar?
⇐ What Is poi-bin-5.2.3-20220909.zip?
2017-04-04, 7800👍, 0💬
Popular Posts:
Jetty provides an HTTP server, HTTP client, and javax.servlet container. These components are open s...
The JMX technology provides the tools for building distributed, Web-based, modular and dynamic solut...
commons-lang-1.0.1.jar is the JAR file for Apache Commons Lang 1.0.1, which provides a host of helpe...
JDK 11 jdk.internal.JVM Stat.jmod is the JMOD file for JDK 11 Internal Jvmstat module. JDK 11 Intern...
What Is ojdbc14.jar for Oracle 10g R2? ojdbc14.jar for Oracle 10g R2 is the JAR files of ojdbc.jar, ...