Package org.apache.poi.hssf.record.formula

Examples of org.apache.poi.hssf.record.formula.NumberPtg


            String numberStr = number.toString();
            int intVal;
            try {
                intVal = Integer.parseInt(numberStr);
            } catch (NumberFormatException e) {
                return new NumberPtg(numberStr);
            }
            if (IntPtg.isInRange(intVal)) {
                return new IntPtg(intVal);
            }
            return new NumberPtg(numberStr);
        }

        if (number1 != null) {
            number.append(number1);
        }

        number.append('.');
        number.append(number2);

        if (exponent != null) {
            number.append('E');
            number.append(exponent);
        }

        return new NumberPtg(number.toString());
    }
View Full Code Here


    assertEquals(40000, ip.getValue());

    // check the upper edge of the IntPtg range:
    ip = (IntPtg) parseSingleToken("65535", IntPtg.class);
    assertEquals(65535, ip.getValue());
    NumberPtg np = (NumberPtg) parseSingleToken("65536", NumberPtg.class);
    assertEquals(65536, np.getValue(), 0);

    np = (NumberPtg) parseSingleToken("65534.6", NumberPtg.class);
    assertEquals(65534.6, np.getValue(), 0);
  }
View Full Code Here

            String numberStr = number.toString();
            int intVal;
            try {
                intVal = Integer.parseInt(numberStr);
            } catch (NumberFormatException e) {
                return new NumberPtg(numberStr);
            }
            if (IntPtg.isInRange(intVal)) {
                return new IntPtg(intVal);
            }
            return new NumberPtg(numberStr);
        }

        if (number1 != null) {
            number.append(number1);
        }

        number.append('.');
        number.append(number2);

        if (exponent != null) {
            number.append('E');
            number.append(exponent);
        }

        return new NumberPtg(number.toString());
    }
View Full Code Here

    assertEquals(40000, ip.getValue());

    // check the upper edge of the IntPtg range:
    ip = (IntPtg) parseSingleToken("65535", IntPtg.class);
    assertEquals(65535, ip.getValue());
    NumberPtg np = (NumberPtg) parseSingleToken("65536", NumberPtg.class);
    assertEquals(65536, np.getValue(), 0);

    np = (NumberPtg) parseSingleToken("65534.6", NumberPtg.class);
    assertEquals(65534.6, np.getValue(), 0);
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.formula.NumberPtg

Copyright © 2018 www.massapicom. 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.