DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=33160>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33160 Summary: cell formula "40000" throws NumberFormatException: Value out of range Product: POI Version: 2.5 Platform: PC OS/Version: Windows XP Status: NEW Severity: critical Priority: P1 Component: HSSF AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] BRIEF DESCRIPTION: ------------------------------------------------- Entering a simple cell formula string like : "40000" gives NumberFormatException, Value out of range. Value:"40000" Radix:10 This is bug because Excel accepts the formulas in this format (ie. if entered as =40000) and evaluates it correctly. (Also if formula is entered directly via excel it is retained on closing and reopening the file) CODE DEMONSTRATING THE BUG: ------------------------------------------------- import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; public class TestPOI { public static void main(String[] args) throws Exception { HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet(); HSSFRow row = sheet.createRow(0); HSSFCell cell = row.createCell((short) 0); cell.setCellFormula("40000"); } } ------------------------------------------------- The exception trace is: java.lang.NumberFormatException: Value out of range. Value:"40000" Radix:10 at java.lang.Short.parseShort(Unknown Source) at java.lang.Short.parseShort(Unknown Source) at org.apache.poi.hssf.record.formula.IntPtg.<init>(IntPtg.java:58) at org.apache.poi.hssf.model.FormulaParser.Factor(FormulaParser.java:486) at org.apache.poi.hssf.model.FormulaParser.Term(FormulaParser.java:548) at org.apache.poi.hssf.model.FormulaParser.Expression(FormulaParser.java:596) at org.apache.poi.hssf.model.FormulaParser.parse(FormulaParser.java:700) at org.apache.poi.hssf.usermodel.HSSFCell.setCellFormula(HSSFCell.java:678) at TestPOI.main(TestPOI.java:11) -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
