Esempio n. 1
0
 /**
  * Returns the contents of the cell, with no formatting applied
  *
  * @return
  */
 String unformattedContents() {
   switch (currentCell.getType()) {
     case "s": // string stored in shared table
       int idx = Integer.parseInt(lastContents);
       return new XSSFRichTextString(sst.getEntryAt(idx)).toString();
     case "inlineStr": // inline string (not in sst)
       return new XSSFRichTextString(lastContents).toString();
     default:
       return lastContents;
   }
 }
Esempio n. 2
0
 /**
  * Tries to format the contents of the last contents appropriately based on the type of cell and
  * the discovered numeric format.
  *
  * @return
  */
 String formattedContents() {
   switch (currentCell.getType()) {
     case "s": // string stored in shared table
       int idx = Integer.parseInt(lastContents);
       return new XSSFRichTextString(sst.getEntryAt(idx)).toString();
     case "inlineStr": // inline string (not in sst)
       return new XSSFRichTextString(lastContents).toString();
     case "str": //
       return lastContents;
     case "e": // error type
       return StringUtils.EMPTY; // "ERROR:  " + lastContents;
     case "n": // numeric type
       if (currentCell.getNumericFormat() != null && lastContents.length() > 0) {
         return dataFormatter.formatRawCellContents(
             Double.parseDouble(lastContents),
             currentCell.getNumericFormatIndex(),
             currentCell.getNumericFormat());
       } else {
         return lastContents;
       }
     default:
       return lastContents;
   }
 }