Java Code Examples for org.apache.poi.hssf.record.BoundSheetRecord#orderByBofPosition()

The following examples show how to use org.apache.poi.hssf.record.BoundSheetRecord#orderByBofPosition() . 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: BofRecordHandler.java    From easyexcel with Apache License 2.0 6 votes vote down vote up
private void initReadSheetDataList(XlsReadWorkbookHolder xlsReadWorkbookHolder) {
    if (xlsReadWorkbookHolder.getActualSheetDataList() != null) {
        return;
    }
    BoundSheetRecord[] boundSheetRecords =
        BoundSheetRecord.orderByBofPosition(xlsReadWorkbookHolder.getBoundSheetRecordList());
    List<ReadSheet> readSheetDataList = new ArrayList<ReadSheet>();
    for (int i = 0; i < boundSheetRecords.length; i++) {
        BoundSheetRecord boundSheetRecord = boundSheetRecords[i];
        ReadSheet readSheet = new ReadSheet(i, boundSheetRecord.getSheetname());
        readSheetDataList.add(readSheet);
    }
    xlsReadWorkbookHolder.setActualSheetDataList(readSheetDataList);
    // Just need to get the list of sheets
    if (!xlsReadWorkbookHolder.getNeedReadSheet()) {
        throw new ExcelAnalysisStopException("Just need to get the list of sheets.");
    }
}