Top Description Inners Constructors Methods
org.apache.poi.hssf.eventusermodel

public Class EventWorkbookBuilder

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .List, org.apache.poi.hssf.model.HSSFFormulaParser, .InternalWorkbook, org.apache.poi.hssf.record.BoundSheetRecord, .EOFRecord, .ExternSheetRecord, .SSTRecord, .SupBookRecord, org.apache.poi.hssf.usermodel.HSSFWorkbook

When working with the EventUserModel, if you want to process formulas, you need an instance of InternalWorkbook to pass to a HSSFWorkbook, to finally give to HSSFFormulaParser, and this will build you stub ones. Since you're working with the EventUserModel, you wouldn't want to get a full InternalWorkbook and HSSFWorkbook, as they would eat too much memory. Instead, you should collect a few key records as they go past, then call this once you have them to build a stub InternalWorkbook, and from that a stub HSSFWorkbook, to use with the HSSFFormulaParser. The records you should collect are: * ExternSheetRecord * BoundSheetRecord You should probably also collect SSTRecord, but it's not required to pass this in. To help, this class includes a HSSFListener wrapper that will do the collecting for you.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
EventWorkbookBuilder.SheetRecordCollectingListener

A wrapping HSSFListener which will collect BoundSheetRecords and ExternSheetRecords as they go past, so you can create a Stub InternalWorkbook from them once required.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static InternalWorkbook

Returns:

A stub Workbook suitable for use with HSSFFormulaParser
createStubWorkbook
(ExternSheetRecord[]
The ExternSheetRecords in your file
externs
,
BoundSheetRecord[]
The BoundSheetRecords in your file
bounds
,
SSTRecord
The SSTRecord in your file.
sst
)

Creates a stub Workbook from the supplied records, suitable for use with the HSSFFormulaParser

public static InternalWorkbook

Returns:

A stub Workbook suitable for use with HSSFFormulaParser
createStubWorkbook
(ExternSheetRecord[]
The ExternSheetRecords in your file
externs
,
BoundSheetRecord[]
The BoundSheetRecords in your file
bounds
)

Creates a stub workbook from the supplied records, suitable for use with the HSSFFormulaParser

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EventWorkbookBuilderback to summary
public EventWorkbookBuilder()

Method Detail

createStubWorkbookback to summary
public static InternalWorkbook createStubWorkbook(ExternSheetRecord[] externs, BoundSheetRecord[] bounds, SSTRecord sst)

Creates a stub Workbook from the supplied records, suitable for use with the HSSFFormulaParser

Parameters
externs:ExternSheetRecord[]

The ExternSheetRecords in your file

bounds:BoundSheetRecord[]

The BoundSheetRecords in your file

sst:SSTRecord

The SSTRecord in your file.

Returns:InternalWorkbook

A stub Workbook suitable for use with HSSFFormulaParser

createStubWorkbookback to summary
public static InternalWorkbook createStubWorkbook(ExternSheetRecord[] externs, BoundSheetRecord[] bounds)

Creates a stub workbook from the supplied records, suitable for use with the HSSFFormulaParser

Parameters
externs:ExternSheetRecord[]

The ExternSheetRecords in your file

bounds:BoundSheetRecord[]

The BoundSheetRecords in your file

Returns:InternalWorkbook

A stub Workbook suitable for use with HSSFFormulaParser

org.apache.poi.hssf.eventusermodel back to summary

public Class EventWorkbookBuilder.SheetRecordCollectingListener

extends Object
implements HSSFListener
Class Inheritance
  • java.lang.Object
  • org.apache.poi.hssf.eventusermodel.EventWorkbookBuilder.SheetRecordCollectingListener
All Implemented Interfaces
org.apache.poi.hssf.eventusermodel.HSSFListener

A wrapping HSSFListener which will collect BoundSheetRecords and ExternSheetRecords as they go past, so you can create a Stub InternalWorkbook from them once required.

Field Summary

Modifier and TypeField and Description
private final List<BoundSheetRecord>
private final HSSFListener
private final List<ExternSheetRecord>
private SSTRecord

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public BoundSheetRecord[]
public ExternSheetRecord[]
public SSTRecord
public HSSFWorkbook
public InternalWorkbook
public void
processRecord(Record
the record to be processed
record
)

Implements org.apache.poi.hssf.eventusermodel.HSSFListener.processRecord.

Process this record ourselves, and then pass it on to our child listener

public void
processRecordInternally(Record
the record to be processed
record
)

Process the record ourselves, but do not pass it on to the child Listener.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

boundSheetRecordsback to summary
private final List<BoundSheetRecord> boundSheetRecords
childListenerback to summary
private final HSSFListener childListener
externSheetRecordsback to summary
private final List<ExternSheetRecord> externSheetRecords
sstRecordback to summary
private SSTRecord sstRecord

Constructor Detail

SheetRecordCollectingListenerback to summary
public SheetRecordCollectingListener(HSSFListener childListener)

Method Detail

getBoundSheetRecordsback to summary
public BoundSheetRecord[] getBoundSheetRecords()
getExternSheetRecordsback to summary
public ExternSheetRecord[] getExternSheetRecords()
getSSTRecordback to summary
public SSTRecord getSSTRecord()
getStubHSSFWorkbookback to summary
public HSSFWorkbook getStubHSSFWorkbook()
getStubWorkbookback to summary
public InternalWorkbook getStubWorkbook()
processRecordback to summary
public void processRecord(Record record)

Implements org.apache.poi.hssf.eventusermodel.HSSFListener.processRecord.

Process this record ourselves, and then pass it on to our child listener

Parameters
record:Record

Doc from org.apache.poi.hssf.eventusermodel.HSSFListener.processRecord.

the record to be processed

Annotations
@Override
processRecordInternallyback to summary
public void processRecordInternally(Record record)

Process the record ourselves, but do not pass it on to the child Listener.

Parameters
record:Record

the record to be processed