Example usage for org.apache.poi.hssf.record BoundSheetRecord getSheetname

List of usage examples for org.apache.poi.hssf.record BoundSheetRecord getSheetname

Introduction

In this page you can find the example usage for org.apache.poi.hssf.record BoundSheetRecord getSheetname.

Prototype

public String getSheetname() 

Source Link

Document

get the sheetname for this sheet.

Usage

From source file:ambit.test.io.POIExample.java

License:Open Source License

public void processRecord(Record record) {
    switch (record.getSid()) {
    // the BOFRecord can represent either the beginning of a sheet or the workbook
    case BOFRecord.sid:
        BOFRecord bof = (BOFRecord) record;
        if (bof.getType() == bof.TYPE_WORKBOOK) {
            System.out.println("Encountered workbook");
            // assigned to the class level member
        } else if (bof.getType() == bof.TYPE_WORKSHEET) {
            System.out.println("Encountered sheet reference");
        }/*from w w  w .j a  v a 2s .c o  m*/
        break;
    case BoundSheetRecord.sid:
        BoundSheetRecord bsr = (BoundSheetRecord) record;
        System.out.println("New sheet named: " + bsr.getSheetname());
        break;
    case RowRecord.sid:
        RowRecord rowrec = (RowRecord) record;
        System.out.println("Row found, first column at " + rowrec.getFirstCol() + " last column at "
                + rowrec.getLastCol());
        break;
    case NumberRecord.sid:
        NumberRecord numrec = (NumberRecord) record;
        System.out.println("Cell found with value " + numrec.getValue() + " at row " + numrec.getRow()
                + " and column " + numrec.getColumn());
        break;
    // SSTRecords store a array of unique strings used in Excel.
    case SSTRecord.sid:
        sstrec = (SSTRecord) record;
        for (int k = 0; k < sstrec.getNumUniqueStrings(); k++) {
            System.out.println("String table value " + k + " = " + sstrec.getString(k));
        }
        break;
    case LabelSSTRecord.sid:
        LabelSSTRecord lrec = (LabelSSTRecord) record;
        System.out.println("String cell found with value " + sstrec.getString(lrec.getSSTIndex()));
        break;
    }
}

From source file:com.bayareasoftware.chartengine.ds.util.XLS2Data.java

License:Apache License

public List<String> getSheetNames() {
    List<String> ret = new ArrayList<String>();
    if (this.orderedBSRs != null) {
        for (BoundSheetRecord bsr : orderedBSRs) {
            ret.add(bsr.getSheetname());
        }//www .  j  a  va 2s  . c om
    }
    return ret;
}

From source file:com.netxforge.netxstudio.screens.f4.support.XLSService.java

License:Open Source License

/**
 * This method listens for incoming records and handles them as required.
 * //from w  w  w.  j av a2 s. c  o  m
 * @param record
 *            The record that was found while reading.
 */
private int processRecordInternal(Record record) {

    if (currentMonitor.isCanceled()) {
        // we should interrupt the process here.
        return ABORTED;
    }

    // Produce a multiple kvp for the .xls

    switch (record.getSid()) {
    // the BOFRecord can represent either the beginning of a sheet or the
    // workbook
    case BOFRecord.sid:
        BOFRecord bof = (BOFRecord) record;
        if (bof.getType() == BOFRecord.TYPE_WORKBOOK) {
            System.out.println("Encountered workbook");
            // assigned to the class level member
        } else if (bof.getType() == BOFRecord.TYPE_WORKSHEET) {

            currentRecordMap = Lists.newArrayListWithExpectedSize(32);
            // fill the list with at least x map entries.
            for (int i = 0; i < MAX_VISIBLE_ROWS; i++) {
                Map<Integer, Tuple> map = Maps.newHashMap();
                currentRecordMap.add(map);
            }

            sheets.add(currentRecordMap);
            System.out.println("Encountered sheet reference, changing sheet...");
        }
        break;
    case BoundSheetRecord.sid:
        BoundSheetRecord bsr = (BoundSheetRecord) record;
        System.out.println("New sheet named: " + bsr.getSheetname());

        break;

    // Row records come in batch (32) before the actual cell records.

    case RowRecord.sid:

        RowRecord rowrec = (RowRecord) record;
        // Look for our header row, when found we have to interpret the
        // values.

        System.out.println("Row found" + rowrec.getRowNumber() + ", first column at " + rowrec.getFirstCol()
                + " last column at " + rowrec.getLastCol());
        break;

    // SSTRecords store a array of unique strings used in Excel.
    case SSTRecord.sid:
        currentSStrec = (SSTRecord) record;
        // for (int k = 0; k < currentSStrec.getNumUniqueStrings(); k++) {
        // System.out.println("String table value " + k + " = "
        // + currentSStrec.getString(k));
        // }
        break;
    case DateWindow1904Record.sid: {
        System.out.println("Hitting Date record. ");

    }
        break;
    case NumberRecord.sid:
    case LabelSSTRecord.sid:

        int column = -1;
        int row = -1;
        Object value = null;

        if (record.getSid() == NumberRecord.sid) {
            NumberRecord numrec = (NumberRecord) record;

            double numValue = numrec.getValue();
            column = numrec.getColumn();
            row = numrec.getRow();

            value = this.formatNumberDateCell(numrec, numValue);

            // DEBUG
            System.out.println("Number:Cell found with value " + value + " at: [" + row + "," + column + "]");

        }
        if (record.getSid() == LabelSSTRecord.sid) {
            LabelSSTRecord lrec = (LabelSSTRecord) record;
            value = currentSStrec.getString(lrec.getSSTIndex()).toString();
            column = lrec.getColumn();
            row = lrec.getRow();

            // DEBUG
            System.out.println("String:Cell found with value " + value + " at: [" + row + "," + column + "]");
        }

        if (value != null && row != -1 && column != -1) {
            Tuple t = new Tuple(column, value);

            if (currentRecordMap.size() < row) {
                Map<Integer, Tuple> map = Maps.newHashMap();
                currentRecordMap.add(map);
            }
            currentRecordMap.get(row).put(column, t);

        } else {
            System.err.println("Incomplete cell encountered" + "v=" + value + " r=" + row + " c=" + column);
        }
        // TODO, do a more gracefull check with a switch break to proceed,
        // or other strategy if this fails.
        // assert row > 0 && column > 0 && value != null;

        if (column == 0) {
            currentMonitor.worked(1);
            currentRowProgress = true; // reset for the next row.
            processedRows++; // Update the number of processed rows.

        } else {
            // Did we have a failure on a previous column, if so skip this
            // column until the next row.
            if (!currentRowProgress) {
                break;
            }
            // We have an undefined column.
            this.currentRowProgress = false;

        }

        break;
    }
    return OK;
}

From source file:com.sonicle.webtop.core.io.input.XlsPartsProcessorOLD.java

License:Open Source License

@Override
public void processRecord(Record record) {
    cellValue = null;/*from w w w  .  j a v a2 s . c  om*/

    switch (record.getSid()) {
    case BoundSheetRecord.sid:
        BoundSheetRecord bsr = (BoundSheetRecord) record;
        if (!sheetFound) {
            if (StringUtils.equals(bsr.getSheetname(), sheetName)) {
                sheetFound = true;
                columnNames = new LinkedHashMap<>();
                columnIndexes = new HashMap<>();
            }
        } else {
            close();
        }
        break;

    case SSTRecord.sid:
        sstRecord = (SSTRecord) record;
        break;

    case BlankRecord.sid:
        BlankRecord br = (BlankRecord) record;
        row = br.getRow();
        col = br.getColumn();
        cellValue = "";
        break;

    case BoolErrRecord.sid:
        BoolErrRecord ber = (BoolErrRecord) record;
        row = ber.getRow();
        col = ber.getColumn();
        cellValue = "";
        break;

    case FormulaRecord.sid:
        FormulaRecord fr = (FormulaRecord) record;
        row = fr.getRow();
        col = fr.getColumn();
        if (Double.isNaN(fr.getValue())) {
            // Formula result is a string that is stored in the next record!
            findNextStringRecord = true;
            nextRow = fr.getRow();
            nextCol = fr.getColumn();
            cellValue = null;
        } else {
            cellValue = formatTrackingListener.formatNumberDateCell(fr);
        }
        break;

    case StringRecord.sid:
        if (findNextStringRecord) {
            // String for formula 
            StringRecord sr = (StringRecord) record;
            cellValue = sr.getString();
            row = nextRow;
            col = nextCol;
            // Resets markers...
            findNextStringRecord = false;
            nextRow = -1;
            nextCol = -1;
        }
        break;

    case LabelRecord.sid:
        LabelRecord lr = (LabelRecord) record;
        row = lr.getRow();
        col = lr.getColumn();
        cellValue = lr.getValue();
        break;

    case LabelSSTRecord.sid:
        LabelSSTRecord lsstr = (LabelSSTRecord) record;
        row = lsstr.getRow();
        col = lsstr.getColumn();
        if (sstRecord == null) {
            cellValue = "#ERROR(undefined string)";
        } else {
            cellValue = sstRecord.getString(lsstr.getSSTIndex()).toString();
        }
        break;

    case NoteRecord.sid:
        NoteRecord nr = (NoteRecord) record;
        row = nr.getRow();
        col = nr.getColumn();
        // TODO: Find object to match nrec.getShapeId() 
        cellValue = "#ERROR(TODO)";
        break;

    case NumberRecord.sid:
        NumberRecord rn = (NumberRecord) record;
        row = rn.getRow();
        col = rn.getColumn();
        cellValue = formatTrackingListener.formatNumberDateCell(rn);
        break;

    case RKRecord.sid:
        RKRecord rkr = (RKRecord) record;
        row = rkr.getRow();
        col = rkr.getColumn();
        cellValue = "#ERROR(TODO)";
        break;

    default:
        cellValue = null;
    }

    if (row == headersRow) {
        String cellReference = CellReference.convertNumToColString(col);
        String name = (headersRow == firstDataRow) ? cellReference
                : StringUtils.defaultIfBlank(cellValue, cellReference);
        columnNames.put(name.toLowerCase(), name);
        columnIndexes.put(name, col);
    }
}

From source file:com.sonicle.webtop.core.io.input.XlsRecordsProcessor.java

License:Open Source License

@Override
public void processRecord(Record record) {
    int thisRow = -1;
    int thisCol = -1;
    cellValue = null;//from   ww  w  . j  a  va 2 s  .  c o  m

    switch (record.getSid()) {
    case BoundSheetRecord.sid:
        BoundSheetRecord bsr = (BoundSheetRecord) record;
        if (!sheetFound) {
            if (StringUtils.equals(bsr.getSheetname(), sheetName)) {
                sheetFound = true;
                columnNames = new LinkedHashMap<>();
                columnIndexes = new HashMap<>();
            }
        } else {
            close();
        }
        break;

    case SSTRecord.sid:
        sstRecord = (SSTRecord) record;
        break;

    case BlankRecord.sid:
        BlankRecord br = (BlankRecord) record;
        thisRow = br.getRow();
        thisCol = br.getColumn();
        cellValue = "";
        break;

    case BoolErrRecord.sid:
        BoolErrRecord ber = (BoolErrRecord) record;
        thisRow = ber.getRow();
        thisCol = ber.getColumn();
        cellValue = "";
        break;

    case FormulaRecord.sid:
        FormulaRecord fr = (FormulaRecord) record;
        thisRow = fr.getRow();
        thisCol = fr.getColumn();
        if (Double.isNaN(fr.getValue())) {
            // Formula result is a string that is stored in the next record!
            findNextStringRecord = true;
            nextRow = fr.getRow();
            nextCol = fr.getColumn();
            cellValue = null;
        } else {
            cellValue = formatTrackingListener.formatNumberDateCell(fr);
        }
        break;

    case StringRecord.sid:
        if (findNextStringRecord) {
            // String for formula 
            StringRecord sr = (StringRecord) record;
            cellValue = sr.getString();
            thisRow = nextRow;
            thisCol = nextCol;
            // Resets markers...
            findNextStringRecord = false;
            nextRow = -1;
            nextCol = -1;
        }
        break;

    case LabelRecord.sid:
        LabelRecord lr = (LabelRecord) record;
        thisRow = lr.getRow();
        thisCol = lr.getColumn();
        cellValue = lr.getValue();
        break;

    case LabelSSTRecord.sid:
        LabelSSTRecord lsstr = (LabelSSTRecord) record;
        thisRow = lsstr.getRow();
        thisCol = lsstr.getColumn();
        if (sstRecord == null) {
            cellValue = "#ERROR(undefined string)";
        } else {
            cellValue = sstRecord.getString(lsstr.getSSTIndex()).toString();
        }
        break;

    case NoteRecord.sid:
        NoteRecord nr = (NoteRecord) record;
        thisRow = nr.getRow();
        thisCol = nr.getColumn();
        // TODO: Find object to match nrec.getShapeId() 
        cellValue = "#ERROR(TODO)";
        break;

    case NumberRecord.sid:
        NumberRecord rn = (NumberRecord) record;
        thisRow = rn.getRow();
        thisCol = rn.getColumn();
        cellValue = formatTrackingListener.formatNumberDateCell(rn);
        break;

    case RKRecord.sid:
        RKRecord rkr = (RKRecord) record;
        thisRow = rkr.getRow();
        thisCol = rkr.getColumn();
        cellValue = "#ERROR(TODO)";
        break;

    default:
        cellValue = null;
    }

    // Handle new row
    if ((thisRow != -1) && (thisRow != row)) {
        row = -1;
        isNewRow = true;
    } else {
        isNewRow = false;
    }
    if (thisRow > -1)
        row = thisRow;
    if (thisCol > -1)
        col = thisCol;
    isInRange = ((row >= firstDataRow) && ((lastDataRow == -1) || (row <= lastDataRow)));

    // Handle end of row
    if (record instanceof LastCellOfRowDummyRecord) {
        isDummyEndRow = true;
        col = -1; // We're nearly onto a new row
    } else {
        isDummyEndRow = false;
    }

    if (!isDummyEndRow && (row == headersRow)) {
        String cellReference = CellReference.convertNumToColString(col);
        String name = (headersRow == firstDataRow) ? cellReference
                : StringUtils.defaultIfBlank(cellValue, cellReference);
        columnNames.put(name.toLowerCase(), name);
        columnIndexes.put(name, col);
    }
}

From source file:com.sonicle.webtop.core.io.input.XlsSheetsProcessor.java

License:Open Source License

@Override
public void processRecord(Record record) {
    short sid = record.getSid();
    switch (sid) {
    case BoundSheetRecord.sid:
        BoundSheetRecord bsr = (BoundSheetRecord) record;
        sheetNames.add(bsr.getSheetname());
    }//  ww  w. j a v  a2  s .  c  om
}

From source file:org.jreserve.gui.poi.read.xls.XlsTableReader.java

License:Open Source License

private void boundRecord(BoundSheetRecord record) {
    sheets.add(record.getSheetname());
}

From source file:org.opencrx.kernel.text.ExcelToText.java

License:BSD License

/**
 * This method listens for incoming records and handles them as required.
 * // w  w  w  .j  a va2  s . co  m
 * @param record
 *        The record that was found while reading.
 */
public void processRecord(Record record) {
    int curentRow = 0;
    if (this.sstrec != null) {
        try {
            if (record instanceof CellValueRecordInterface) {
                if (record instanceof LabelSSTRecord) {
                    LabelSSTRecord bof2 = (LabelSSTRecord) record;
                    int rowNum = ((CellValueRecordInterface) record).getRow();
                    if (curentRow < rowNum) {
                        this.text.append(" ");
                        curentRow = rowNum;
                    }
                    try {
                        String value = sstrec.getString(bof2.getSSTIndex()).toString();
                        this.text.append(value + " ");
                    } catch (Exception e) {
                    }
                }
                if (record instanceof NumberRecord) {
                    NumberRecord bof2 = (NumberRecord) record;
                    int rowNum = ((CellValueRecordInterface) record).getRow();
                    if (curentRow < rowNum) {
                        this.text.append(" ");
                        curentRow = rowNum;
                    }
                    String value = (new Double(bof2.getValue())).toString();
                    this.text.append(value + " ");
                }
            }
        } catch (Exception ex) {
        } catch (NoSuchMethodError e) {
        }
    }
    switch (record.getSid()) {
    case BoundSheetRecord.sid:
        BoundSheetRecord bsr = (BoundSheetRecord) record;
        this.text.append(bsr.getSheetname() + " ");
        break;
    case SSTRecord.sid:
        this.sstrec = (SSTRecord) record;
        break;
    case DSFRecord.sid:
        break;

    case TextObjectRecord.sid:
        TextObjectRecord textObjectRecord = (TextObjectRecord) record;
        HSSFRichTextString q = textObjectRecord.getStr();
        String st = q.getString();
        if (st != null && !"".equals(st)) {
            int ind = this.text.indexOf(st);
            if (ind == -1) {
                this.text.append(st + " ");
            }
        }
        break;

    case StringRecord.sid:
        StringRecord selectionRecord = (StringRecord) record;
        String str = selectionRecord.getString();
        if (str != null && !"".equals(str)) {
            int ind = this.text.indexOf(str);
            if (ind == -1) {
                this.text.append(str + " ");
            }
        }
        break;
    }
}

From source file:org.tonguetied.datatransfer.importing.ExcelKeywordParser.java

License:Apache License

public void processRecord(Record record) {
    if (record == null) {
        if (logger.isInfoEnabled())
            logger.info("no record to process");
    } else {/*from ww  w . j  a  v  a  2 s. c o m*/
        switch (record.getSid()) {
        // the BOFRecord can represent either the beginning of a sheet 
        // or the workbook
        case BOFRecord.sid:
            if (!(record instanceof BOFRecord))
                throw new ImportException("unknown excel element", null);
            final BOFRecord bof = (BOFRecord) record;
            if (bof.getType() == BOFRecord.TYPE_WORKBOOK) {
                if (logger.isInfoEnabled())
                    logger.info("Processing excel workbook");
                // assigned to the class level member
            } else if (bof.getType() == BOFRecord.TYPE_WORKSHEET) {
                if (logger.isInfoEnabled())
                    logger.info("recordsize = " + bof.getRecordSize() + ", required version = "
                            + bof.getRequiredVersion());
            }
            break;
        case BoundSheetRecord.sid:
            if (!(record instanceof BoundSheetRecord))
                throw new ImportException("unknown excel element", null);
            final BoundSheetRecord bsr = (BoundSheetRecord) record;
            // sheets named have no impact on generating query
            if (logger.isDebugEnabled())
                logger.debug("processing sheet: " + bsr.getSheetname());
            break;
        case RowRecord.sid:
            if (!(record instanceof RowRecord))
                throw new ImportException("unknown excel element", null);
            if (logger.isDebugEnabled()) {
                final RowRecord rowrec = (RowRecord) record;
                logger.debug("processing row: " + rowrec.getRowNumber());
            }
            break;
        case NumberRecord.sid:
            if (!(record instanceof NumberRecord))
                throw new ImportException("unknown excel element", null);
            final NumberRecord numrec = (NumberRecord) record;
            logger.warn("Cell [" + numrec.getRow() + "," + numrec.getColumn()
                    + "] expecting a string value not numeric: " + numrec.getValue() + ". Ignoring value");
            break;
        case SSTRecord.sid:
            if (!(record instanceof SSTRecord))
                throw new ImportException("unknown excel element", null);
            // SSTRecords store a array of unique strings used in Excel.
            sstrec = (SSTRecord) record;
            if (logger.isDebugEnabled()) {
                logger.debug("file contains " + sstrec.getNumUniqueStrings() + " unique strings");
            }
            break;
        case LabelSSTRecord.sid:
            if (!(record instanceof LabelSSTRecord))
                throw new ImportException("unknown excel element", null);
            final LabelSSTRecord lrec = (LabelSSTRecord) record;
            if (lrec.getRow() != 0) {
                if (lrec.getColumn() == 0) {
                    evaluateRowType(lrec);
                } else {
                    final String cellValue = sstrec.getString(lrec.getSSTIndex()).getString();
                    if (lrec.getColumn() == 1) {
                        switch (rowType) {
                        case keyword:
                            // there were no translations for the previous keyword, so add to keywords
                            if (keyword != null && keyword.getTranslations().isEmpty())
                                keywords.put(keyword.getKeyword(), keyword);
                            loadKeyword(cellValue);
                            break;
                        case context:
                            if (StringUtils.isNotBlank(cellValue))
                                keyword.setContext(cellValue);
                            break;
                        default:
                            break;
                        }
                    } else if (lrec.getColumn() == 2) {
                        baseTranslation = new Translation();
                        baseTranslation.setKeyword(keyword);
                        final LanguageCode code = ImporterUtils.evaluateLanguageCode(cellValue, errorCodes);
                        Language language = null;
                        if (code != null) {
                            language = keywordService.getLanguage(code);
                            if (language == null)
                                errorCodes.add(ImportErrorCode.unknownLanguage);
                        }
                        baseTranslation.setLanguage(language);
                    } else if (lrec.getColumn() == 4) {
                        final CountryCode code = ImporterUtils.evaluateCountryCode(cellValue, errorCodes);
                        Country country = null;
                        if (code != null) {
                            country = keywordService.getCountry(code);
                            if (country == null)
                                errorCodes.add(ImportErrorCode.unknownCountry);
                        }
                        baseTranslation.setCountry(country);
                    } else if (lrec.getColumn() == 6) {
                        final Bundle bundle = keywordService.getBundleByName(cellValue);
                        if (bundle == null)
                            errorCodes.add(ImportErrorCode.unknownBundle);
                        baseTranslation.setBundle(bundle);
                    } else if (lrec.getColumn() == 7) {
                        final TranslationState state = ImporterUtils.evaluateTranslationState(cellValue,
                                errorCodes);
                        baseTranslation.setState(state);
                    } else if (lrec.getColumn() == 8) {
                        baseTranslation.setValue(cellValue);
                        keyword.addTranslation(baseTranslation);
                        keywords.put(keyword.getKeyword(), keyword);
                    }
                }

            }
            break;
        default:
            break;
        }
    }
}

From source file:org.tonguetied.datatransfer.importing.ExcelLanguageCentricParser.java

License:Apache License

/**
 * This method listens for incoming records and handles them as required.
 * /*w  w w.j a v  a  2 s .  c  om*/
 * @param record The record that was found while reading.
 */
public void processRecord(Record record) {
    if (record == null) {
        if (logger.isInfoEnabled())
            logger.info("no record to process");
    } else {
        switch (record.getSid()) {
        // the BOFRecord can represent either the beginning of a sheet 
        // or the workbook
        case BOFRecord.sid:
            if (!(record instanceof BOFRecord))
                throw new ImportException("unknown excel element", null);
            final BOFRecord bof = (BOFRecord) record;
            if (bof.getType() == BOFRecord.TYPE_WORKBOOK) {
                if (logger.isInfoEnabled())
                    logger.info("Processing excel workbook");
                // assigned to the class level member
            } else if (bof.getType() == BOFRecord.TYPE_WORKSHEET) {
                if (logger.isInfoEnabled())
                    logger.info("recordsize = " + bof.getRecordSize() + ", required version = "
                            + bof.getRequiredVersion());
            }
            break;
        case BoundSheetRecord.sid:
            if (!(record instanceof BoundSheetRecord))
                throw new ImportException("unknown excel element", null);
            final BoundSheetRecord bsr = (BoundSheetRecord) record;
            // sheets named have no impact on generating query
            if (logger.isDebugEnabled())
                logger.debug("processing sheet: " + bsr.getSheetname());
            break;
        case RowRecord.sid:
            if (!(record instanceof RowRecord))
                throw new ImportException("unknown excel element", null);
            final RowRecord rowrec = (RowRecord) record;
            lastColOfRow = rowrec.getLastCol();
            //                    if (rowrec.getRowNumber() > 0) {
            //                        if (logger.isDebugEnabled())
            //                            logger.debug("creating new keyword instance");
            //                        keyword = new Keyword();
            //                    }
            break;
        case NumberRecord.sid:
            if (!(record instanceof NumberRecord))
                throw new ImportException("unknown excel element", null);
            final NumberRecord numrec = (NumberRecord) record;
            logger.warn("Cell [" + numrec.getRow() + "," + numrec.getColumn()
                    + "] expecting a string value not numeric: " + numrec.getValue() + ". Ignoring value");
            break;
        case SSTRecord.sid:
            if (!(record instanceof SSTRecord))
                throw new ImportException("unknown excel element", null);
            // SSTRecords store a array of unique strings used in Excel.
            sstrec = (SSTRecord) record;
            if (logger.isDebugEnabled()) {
                logger.debug("file contains " + sstrec.getNumUniqueStrings() + " unique strings");
            }
            break;
        case LabelSSTRecord.sid:
            if (!(record instanceof LabelSSTRecord))
                throw new ImportException("unknown excel element", null);
            final LabelSSTRecord lrec = (LabelSSTRecord) record;
            if (lrec.getRow() == 0) {
                processHeader(lrec);
            } else {
                if (lrec.getColumn() == 0) {
                    String keywordStr = sstrec.getString(lrec.getSSTIndex()).getString();
                    loadKeyword(keywordStr);
                } else if (lrec.getColumn() == 1) {
                    keyword.setContext(sstrec.getString(lrec.getSSTIndex()).getString());
                } else if (lrec.getColumn() == 2) {
                    baseTranslation = new Translation();
                    baseTranslation.setKeyword(keyword);
                    String name = sstrec.getString(lrec.getSSTIndex()).getString();
                    Bundle bundle = keywordService.getBundleByName(name);
                    baseTranslation.setBundle(bundle);
                } else if (lrec.getColumn() == 3) {
                    String colHeader = sstrec.getString(lrec.getSSTIndex()).getString();
                    String[] headers = colHeader.split(":");
                    CountryCode code = CountryCode.valueOf(headers[0]);
                    Country country = keywordService.getCountry(code);
                    baseTranslation.setCountry(country);
                } else {
                    Language language = languages.get(lrec.getColumn() - 4);
                    String value = sstrec.getString(lrec.getSSTIndex()).getString();
                    Translation translation = baseTranslation.deepClone();
                    if (language.getCode() == LanguageCode.zht) {
                        language = keywordService.getLanguage(LanguageCode.zh);
                        Country country = keywordService.getCountry(CountryCode.TW);
                        translation.setCountry(country);
                    }
                    translation.setLanguage(language);
                    translation.setState(TranslationState.UNVERIFIED);
                    translation.setValue(value);
                    keyword.addTranslation(translation);
                    //                        System.out.println("String cell found with value "
                    //                                + sstrec.getString(lrec.getSSTIndex()));
                }

                if (isLastColumn(lrec.getColumn())) {
                    keywords.put(keyword.getKeyword(), keyword);
                }
            }
            break;
        default:
            break;
        }
    }
}