Examples of formatCellValue()


Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter.formatCellValue()

              Date xlDtVal=cellData.getDateCellValue();
              cell.setCellValue(new HSSFRichTextString(CommonUtilities.getDateInddMMYYYYFormat(xlDtVal)));
              break;
            }else{
              HSSFDataFormatter format = new HSSFDataFormatter(); // copies the data in the same format
              cell.setCellValue(new HSSFRichTextString(format.formatCellValue(cellData)));
            }
            break;
          }
        }
      }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.DataFormatter.formatCellValue()

       DataFormatter df = new DataFormatter();
      
       r = s.getRow(1);
       assertEquals(1.0, r.getCell(2).getNumericCellValue());
       assertEquals("General", r.getCell(2).getCellStyle().getDataFormatString());
       assertEquals("1", df.formatCellValue(r.getCell(2)));
       assertEquals("1", df.formatRawCellContents(1.0, -1, "@"));
       assertEquals("1", df.formatRawCellContents(1.0, -1, "General"));
             
       r = s.getRow(2);
       assertEquals(12.0, r.getCell(2).getNumericCellValue());
View Full Code Here

Examples of org.apache.poi.ss.usermodel.DataFormatter.formatCellValue()

       assertEquals("1", df.formatRawCellContents(1.0, -1, "General"));
             
       r = s.getRow(2);
       assertEquals(12.0, r.getCell(2).getNumericCellValue());
       assertEquals("General", r.getCell(2).getCellStyle().getDataFormatString());
       assertEquals("12", df.formatCellValue(r.getCell(2)));
       assertEquals("12", df.formatRawCellContents(12.0, -1, "@"));
       assertEquals("12", df.formatRawCellContents(12.0, -1, "General"));
      
       r = s.getRow(3);
       assertEquals(123.0, r.getCell(2).getNumericCellValue());
View Full Code Here

Examples of org.apache.poi.ss.usermodel.DataFormatter.formatCellValue()

       assertEquals("12", df.formatRawCellContents(12.0, -1, "General"));
      
       r = s.getRow(3);
       assertEquals(123.0, r.getCell(2).getNumericCellValue());
       assertEquals("General", r.getCell(2).getCellStyle().getDataFormatString());
       assertEquals("123", df.formatCellValue(r.getCell(2)));
       assertEquals("123", df.formatRawCellContents(123.0, -1, "@"));
       assertEquals("123", df.formatRawCellContents(123.0, -1, "General"));
    }
   
    /**
 
View Full Code Here

Examples of org.apache.poi.ss.usermodel.DataFormatter.formatCellValue()

                        String cellValue = null;
                        try {
                            newCell(listeners,
                                    i,
                                    cellNum,
                                    formatter.formatCellValue(cell, formulaEvaluator),
                                    mergedColStart);
                        } catch (RuntimeException e) {
                            // This is thrown if an external link cannot be resolved, so try the cached value
                            log.warn("Cannot resolve externally linked value: " + formatter.formatCellValue(cell));
                            String cachedValue = tryToReadCachedValue(cell);
View Full Code Here

Examples of org.apache.poi.ss.usermodel.DataFormatter.formatCellValue()

                                    cellNum,
                                    formatter.formatCellValue(cell, formulaEvaluator),
                                    mergedColStart);
                        } catch (RuntimeException e) {
                            // This is thrown if an external link cannot be resolved, so try the cached value
                            log.warn("Cannot resolve externally linked value: " + formatter.formatCellValue(cell));
                            String cachedValue = tryToReadCachedValue(cell);
                            newCell(listeners,
                                    i,
                                    cellNum,
                                    cachedValue,
View Full Code Here

Examples of org.apache.poi.ss.usermodel.DataFormatter.formatCellValue()

                                    mergedColStart);
                        } else {
                            newCell(listeners,
                                    i,
                                    cellNum,
                                    formatter.formatCellValue(cell),
                                    mergedColStart);
                        }
                }
            }
        }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.DataFormatter.formatCellValue()

            case Cell.CELL_TYPE_NUMERIC:
                double num = cell.getNumericCellValue();
                if ( num - Math.round( num ) != 0 ) {
                    cachedValue = String.valueOf( num );
                } else {
                    cachedValue = formatter.formatCellValue( cell );
                }
                break;

            case Cell.CELL_TYPE_STRING:
                cachedValue = cell.getStringCellValue();
View Full Code Here

Examples of org.apache.poi.ss.usermodel.DataFormatter.formatCellValue()

    if (type == CELL_TYPE_FORMULA) {
      in.setCellType(in.getCachedFormulaResultType());
    }

    DataFormatter df = new DataFormatter(Locale.getDefault());
    return df.formatCellValue(in);

  }
 

  protected boolean hasContent(Cell in) {
View Full Code Here

Examples of org.apache.poi.ss.usermodel.DataFormatter.formatCellValue()

       DataFormatter df = new DataFormatter();
      
       r = s.getRow(1);
       assertEquals(1.0, r.getCell(2).getNumericCellValue(), 0);
       assertEquals("General", r.getCell(2).getCellStyle().getDataFormatString());
       assertEquals("1", df.formatCellValue(r.getCell(2)));
       assertEquals("1", df.formatRawCellContents(1.0, -1, "@"));
       assertEquals("1", df.formatRawCellContents(1.0, -1, "General"));
             
       r = s.getRow(2);
       assertEquals(12.0, r.getCell(2).getNumericCellValue(), 0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.