当前位置: 首页>>代码示例>>Java>>正文


Java StringRecord.sid方法代码示例

本文整理汇总了Java中org.apache.poi.hssf.record.StringRecord.sid方法的典型用法代码示例。如果您正苦于以下问题:Java StringRecord.sid方法的具体用法?Java StringRecord.sid怎么用?Java StringRecord.sid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.hssf.record.StringRecord的用法示例。

在下文中一共展示了StringRecord.sid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: recordFound

import org.apache.poi.hssf.record.StringRecord; //导入方法依赖的package包/类
@Override
protected void recordFound(Record record) throws Exception {
    if(tableEnded)
        return;
    
    switch(record.getSid()) {
        case BoundSheetRecord.sid:
            boundRecord((BoundSheetRecord) record);
            break;
        case BOFRecord.sid:
            bofRecord((BOFRecord)record);
            break;
        case SSTRecord.sid:
            sstRecord = (SSTRecord) record;
            break;
        case BoolErrRecord.sid:
            cellRecord((CellRecord)record);
            break;
        case FormulaRecord.sid:
            cellRecord((CellRecord)record);
            break;
        case LabelSSTRecord.sid:
            cellRecord((CellRecord)record);
            break;
        case LabelRecord.sid:
            LabelRecord lr = (LabelRecord) record;
            cellRecord(lr.getRow(), lr.getColumn(), lr);
            break;
        case StringRecord.sid:
            if(outputNextString) {
                cellRecord(prevRow, prevColumn, record);
                outputNextString = false;
            }
            break;
        case NumberRecord.sid:
            cellRecord((CellRecord)record);
            break;
        default:
            break;
    }
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:42,代码来源:XlsTableReader.java


示例2: cellRecord

import org.apache.poi.hssf.record.StringRecord; //导入方法依赖的package包/类
private void cellRecord(int row, short column, Record record) throws Exception {
    try {
        //Not on the good sheet, before first row/column
        if(!onReferencedSheet || firstRow > row || firstColumn > column)
            return;
    
        //The cell is empty, do not read it
        boolean isEmptyCell = isEmpty(record);
        if(isEmptyCell) {
            //If first cell is empty, whole table is empty
            if(firstRow==row && firstColumn == column)
                lastColumn = (short)(firstColumn - 1);
            return;
        }

        //Calculate the last column, based on the first row
        if(firstRow == row) {
            //If we missed a cell, do not read other columns
            if((column - lastColumn) < 2)
                lastColumn = column;
        }

        //after the last column
        if(column > lastColumn)
            return;

        if(column == firstColumn)
            prevColumn = firstColumn;

        //missed a row, do not read further
        if((row - prevRow)> 1 || (column-prevColumn)>1)
            return;

        short sid = record.getSid();
        switch(sid) {
            case NumberRecord.sid:
                factory.numberFound(row, column, ((NumberRecord)record).getValue());
                break;
            case LabelSSTRecord.sid:
                if(sstRecord == null)
                    throw new IllegalArgumentException("SSTRecord is null");
                int stringId = ((LabelSSTRecord)record).getSSTIndex();
                String str = sstRecord.getString(stringId).getString();
                factory.stringFound(row, column, str);
                break;
            case LabelRecord.sid:
                factory.stringFound(row, column, ((LabelRecord)record).getValue());
                break;
            case StringRecord.sid:
                factory.stringFound(row, column, ((StringRecord)record).getString());
                break;
            case FormulaRecord.sid:
                FormulaRecord fr = (FormulaRecord) record;
                if(fr.hasCachedResultString()) {
                    outputNextString = true;
                } else {
                    factory.numberFound(row, column, fr.getValue());
                }
                break;
            case BoolErrRecord.sid:
                BoolErrRecord ber = (BoolErrRecord) record;
                if(ber.isBoolean()) {
                    factory.booleanFound(row, column, ber.getBooleanValue());
                } else {
                    factory.errorFound(row, column, getErrorMsg(ber.getErrorValue()));
                }
                break;
            default:
                break;
        }

        prevRow = row;
        prevColumn = column;
    } catch (Exception ex) {
        CellReference ref = new CellReference(sheetName, row, column, false, false);
        throw new ExcelReadException(ref, ex);
    }
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:79,代码来源:XlsTableReader.java



注:本文中的org.apache.poi.hssf.record.StringRecord.sid方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。