+ protected void loadCell(Cell cell, BeanWrapper bw, String propertyName,
+ String keyProperty, Integer row, List<Reference> references)
+ throws JXLException {
+
+ if (cell instanceof FormulaCell) {
+ String formula = ((FormulaCell) cell).getFormula();
+ int index = formula.indexOf('!');
+ if (index < 0)
+ throw new ArgeoServerException("Cannot interpret formula "
+ + formula);
+ ;
+ String targetSheet = formula.substring(0, index);
+ // assume no double letters!!
+ String targetRowStr = formula.substring(index + 2);
+ if (targetRowStr.charAt(0) == '$')
+ targetRowStr = targetRowStr.substring(1);
+ Integer targetRow = Integer.parseInt(targetRowStr);
+ references.add(new TabularInternalReference(
+ bw.getWrappedInstance(), propertyName, targetSheet,
+ targetRow));
+
+ if (log.isTraceEnabled())
+ log.debug(" formula: " + formula + " | content: "
+ + cell.getContents() + " | targetSheet=" + targetSheet
+ + ", targetRow=" + targetRow);
+ } else {
+ String contents = cell.getContents();
+
+ // if (cell.getType() == CellType.LABEL) {
+ // LabelCell lc = (LabelCell) cell;
+ // contents = lc.getString();
+ // } else if (cell.getType() == CellType.NUMBER) {
+ // NumberCell nc = (NumberCell) cell;
+ // contents = new Double(nc.getValue()).toString();
+ // } else {
+ // contents = cell.getContents();
+ // }
+
+ if (propertyName.equals(keyProperty)
+ && !StringUtils.hasText(contents)) {
+ // auto allocate key column if empty
+ contents = Integer.toString(row);
+ }