Java Code Examples for org.apache.poi.hssf.eventusermodel.HSSFRequest#addListenerForAllRecords()
The following examples show how to use
org.apache.poi.hssf.eventusermodel.HSSFRequest#addListenerForAllRecords() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( String fileName ) throws IOException { this.fs = new POIFSFileSystem( new FileInputStream(fileName) ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 2
Source File: XLS2CSV.java From azeroth with Apache License 2.0 | 6 votes |
/** * Initiates the processing of the XLS file to CSV */ public List<String> process() throws IOException { MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if (outputFormulaValues) { request.addListenerForAllRecords(formatListener); } else { workbookBuildingListener = new SheetRecordCollectingListener(formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); return results; }
Example 3
Source File: HSSFSaxReadHandler.java From myexcel with Apache License 2.0 | 6 votes |
public void process() throws IOException { long startTime = System.currentTimeMillis(); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if (outputFormulaValues) { request.addListenerForAllRecords(formatListener); } else { workbookBuildingListener = new EventWorkbookBuilder.SheetRecordCollectingListener(formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); log.info("Sax import takes {} ms", System.currentTimeMillis() - startTime); }
Example 4
Source File: XLS2CSV.java From bdf3 with Apache License 2.0 | 6 votes |
/** * Initiates the processing of the XLS file to CSV */ public void process() throws IOException { MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if (outputFormulaValues) { request.addListenerForAllRecords(formatListener); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); close(); }
Example 5
Source File: XLS2CSV.java From jeesuite-libs with Apache License 2.0 | 6 votes |
/** * Initiates the processing of the XLS file to CSV */ public List<String> process() throws IOException { MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if(outputFormulaValues) { request.addListenerForAllRecords(formatListener); } else { workbookBuildingListener = new SheetRecordCollectingListener(formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); return results; }
Example 6
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( InputStream is ) throws IOException { this.fs = new POIFSFileSystem( is ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 7
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process(String fileName ) throws IOException { this.fs = new POIFSFileSystem(new FileInputStream(fileName)); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 8
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( InputStream is ) throws IOException { this.fs = new POIFSFileSystem( is ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 9
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process(String fileName ) throws IOException { this.fs = new POIFSFileSystem(new FileInputStream(fileName)); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 10
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( InputStream is ) throws IOException { this.fs = new POIFSFileSystem( is ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 11
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( InputStream is ) throws IOException { this.fs = new POIFSFileSystem( is ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 12
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( String fileName ) throws IOException { this.fs = new POIFSFileSystem( new FileInputStream(fileName) ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 13
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( InputStream is ) throws IOException { this.fs = new POIFSFileSystem( is ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 14
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( String fileName ) throws IOException { this.fs = new POIFSFileSystem( new FileInputStream(fileName) ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 15
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( InputStream is ) throws IOException { this.fs = new POIFSFileSystem( is ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 16
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( String fileName ) throws IOException { this.fs = new POIFSFileSystem( new FileInputStream(fileName) ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 17
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( InputStream is ) throws IOException { this.fs = new POIFSFileSystem( is ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 18
Source File: Excel2003Reader.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
/** * 遍历excel下所有的sheet * @param fileKey * @throws IOException */ public void process( String fileName ) throws IOException { this.fs = new POIFSFileSystem( new FileInputStream(fileName) ); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener( this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if ( outputFormulaValues ) { request.addListenerForAllRecords( formatListener ); } else { workbookBuildingListener = new SheetRecordCollectingListener( formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); //数据读取完成 }
Example 19
Source File: XlsSaxAnalyser.java From easyexcel with Apache License 2.0 | 6 votes |
@Override public void execute() { XlsReadWorkbookHolder xlsReadWorkbookHolder = xlsReadContext.xlsReadWorkbookHolder(); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this); xlsReadWorkbookHolder.setFormatTrackingHSSFListener(new FormatTrackingHSSFListener(listener)); EventWorkbookBuilder.SheetRecordCollectingListener workbookBuildingListener = new EventWorkbookBuilder.SheetRecordCollectingListener( xlsReadWorkbookHolder.getFormatTrackingHSSFListener()); xlsReadWorkbookHolder.setHssfWorkbook(workbookBuildingListener.getStubHSSFWorkbook()); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); request.addListenerForAllRecords(xlsReadWorkbookHolder.getFormatTrackingHSSFListener()); try { factory.processWorkbookEvents(request, xlsReadWorkbookHolder.getPoifsFileSystem()); } catch (IOException e) { throw new ExcelAnalysisException(e); } }
Example 20
Source File: XlsListSheetListener.java From easyexcel with Apache License 2.0 | 5 votes |
public void execute() { MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this); HSSFListener formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); EventWorkbookBuilder.SheetRecordCollectingListener workbookBuildingListener = new EventWorkbookBuilder.SheetRecordCollectingListener(formatListener); request.addListenerForAllRecords(workbookBuildingListener); try { factory.processWorkbookEvents(request, xlsReadContext.xlsReadWorkbookHolder().getPoifsFileSystem()); } catch (IOException e) { throw new ExcelAnalysisException(e); } }