org.apache.poi.hssf.eventusermodel.EventWorkbookBuilder.SheetRecordCollectingListener Java Examples

The following examples show how to use org.apache.poi.hssf.eventusermodel.EventWorkbookBuilder.SheetRecordCollectingListener. 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 vote down vote up
/**
 * 遍历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 #2
Source File: XLS2CSV.java    From jeesuite-libs with Apache License 2.0 6 votes vote down vote up
/**
 * 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: XLS2CSV.java    From bdf3 with Apache License 2.0 6 votes vote down vote up
/**
 * 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 #4
Source File: XLS2CSV.java    From azeroth with Apache License 2.0 6 votes vote down vote up
/**
 * 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 #5
Source File: Excel2003Reader.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 遍历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 #6
Source File: Excel2003Reader.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 遍历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 #7
Source File: Excel2003Reader.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 遍历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 #8
Source File: Excel2003Reader.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 遍历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 #9
Source File: Excel2003Reader.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 遍历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 vote down vote up
/**
 * 遍历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 #11
Source File: Excel2003Reader.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 遍历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 vote down vote up
/**
 * 遍历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 vote down vote up
/**
 * 遍历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 vote down vote up
/**
 * 遍历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 vote down vote up
/**
 * 遍历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 vote down vote up
/**
 * 遍历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 vote down vote up
/**
 * 遍历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: HSSFEventParser.java    From hadoopoffice with Apache License 2.0 2 votes vote down vote up
public void setSheetRecordCollectingListener(SheetRecordCollectingListener listener) {
	this.workbookBuildingListener=listener;
	
}