From cf0d23d3de1d207dc1999e04b59302da47d426c0 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Sat, 16 May 2009 17:39:31 +0000 Subject: [PATCH] Fix bug #47154 - Handle the cell format @ as the same as General git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@775500 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/changes.xml | 1 + src/documentation/content/xdocs/status.xml | 1 + .../poi/ss/usermodel/DataFormatter.java | 2 +- .../org/apache/poi/hssf/data/47154.xls | Bin 0 -> 6656 bytes .../hssf/usermodel/TestHSSFDataFormatter.java | 20 ++++++++++++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/testcases/org/apache/poi/hssf/data/47154.xls diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index a279c64ac..cdb6bdfe8 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -37,6 +37,7 @@ + 47154 - Handle the cell format @ as the same as General 47048 - Fixed evaluation of defined names with the 'complex' flag set 46953 - More tweaks to PageSettingsBlock parsing logic in Sheet constructor 47089 - Fixed XSSFWorkbook.createSheet to properly increment sheetId diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 65e7caa03..2008d00b3 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 47154 - Handle the cell format @ as the same as General 47048 - Fixed evaluation of defined names with the 'complex' flag set 46953 - More tweaks to PageSettingsBlock parsing logic in Sheet constructor 47089 - Fixed XSSFWorkbook.createSheet to properly increment sheetId diff --git a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java index 378f3303c..50e3690f7 100755 --- a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java +++ b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java @@ -147,7 +147,7 @@ public class DataFormatter { if (format != null) { return format; } - if (formatStr.equals("General")) { + if (formatStr.equals("General") || formatStr.equals("@")) { if (DataFormatter.isWholeNumber(cellValue)) { return generalWholeNumFormat; } diff --git a/src/testcases/org/apache/poi/hssf/data/47154.xls b/src/testcases/org/apache/poi/hssf/data/47154.xls new file mode 100644 index 0000000000000000000000000000000000000000..2840cc61b6f9cfe1c509c894070dd1965bdad49a GIT binary patch literal 6656 zcmeHLUu=_A6hB|rmUbIkw*e~1{G8DJ>yWWTA&ToZrV!m&2E-Q(L+)qbLpV?U3>%O(#-#mhzDiz=F;hOhK*v8ZX*rc zaOO%IdSOH#K%1`u0zeR8U73^LMoTMBH4hE+OA@~cF{N9MARm*LVCnp69d?XcOg=r` z{vx0Dw`x5BDk{nLNbkCyV9p3{Bt3wQ_RIqr?FSYpupx2RL+5Hq+pcN%`&Gd$R% zr;t`)Pmx=#X^p05wcS^mMwRorraN_SqH$Er?Z|jvnZ|x&{|cmre4%|VE2kAZ^;^`W zUwy+l7Cxf`9&tosl8~%gv|Fj#T5q{bG2%Yf-P_&Y@kFiHFYjS)5}naAH6?$fO~}j8 zv`IdvsQlma<8#f6wa>-psEf7#|MI7xQk~<{_&@^D4`)d9~%$yvACk`5McYej2;mkmK0vZ=oYk_rBqHe4>>c zORx40XB#=4yzph(w4K12H}Lya4$<4E23RTn6uq*6P{08hH3;rSf_sU1hSw%#DMp8H zaF-0oQ3JQhz_bxX8kO2>j30<60Sp#Eya@b>kiuAF`=roKKB*jIKZAL2Jyj|vgc1Mx z;Mz|;1AXmJDc{l?D+T~^{({+` z9E}}`^d`qfV~M(O>$Y&mS_C14q@|nn#h#6u;l5)!{A-$qF_ku@tL^o!as$f8S}snu zTuik$y2@wZl!90w6>i9+M2v`$>7U6BIe@XtCuERd|+VYg>^_-Ig@nmV`+Qwj}z@TT(?t zkv@!lNh(?}b8>G!tt)B4t!@j#FBWV;^eNbaYTacf25#sjILN$nh642ef*Y37qrCI? zj0}z?$CE=7X7`JO@r1eK!Iu58fp{VjN1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