You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2009/05/16 19:39:31 UTC

svn commit: r775500 - in /poi/trunk/src: documentation/content/xdocs/ java/org/apache/poi/ss/usermodel/ testcases/org/apache/poi/hssf/data/ testcases/org/apache/poi/hssf/usermodel/

Author: nick
Date: Sat May 16 17:39:31 2009
New Revision: 775500

URL: http://svn.apache.org/viewvc?rev=775500&view=rev
Log:
Fix bug #47154 - Handle the cell format @ as the same as General

Added:
    poi/trunk/src/testcases/org/apache/poi/hssf/data/47154.xls   (with props)
Modified:
    poi/trunk/src/documentation/content/xdocs/changes.xml
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java

Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=775500&r1=775499&r2=775500&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Sat May 16 17:39:31 2009
@@ -37,6 +37,7 @@
 
 		<!-- Don't forget to update status.xml too! -->
         <release version="3.5-beta6" date="2009-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">47154 - Handle the cell format @ as the same as General</action>
            <action dev="POI-DEVELOPERS" type="fix">47048 - Fixed evaluation of defined names with the 'complex' flag set</action>
            <action dev="POI-DEVELOPERS" type="fix">46953 - More tweaks to PageSettingsBlock parsing logic in Sheet constructor</action>
            <action dev="POI-DEVELOPERS" type="fix">47089 - Fixed XSSFWorkbook.createSheet to properly increment sheetId</action>

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=775500&r1=775499&r2=775500&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sat May 16 17:39:31 2009
@@ -34,6 +34,7 @@
 	<!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.5-beta6" date="2009-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">47154 - Handle the cell format @ as the same as General</action>
            <action dev="POI-DEVELOPERS" type="fix">47048 - Fixed evaluation of defined names with the 'complex' flag set</action>
            <action dev="POI-DEVELOPERS" type="fix">46953 - More tweaks to PageSettingsBlock parsing logic in Sheet constructor</action>
            <action dev="POI-DEVELOPERS" type="fix">47089 - Fixed XSSFWorkbook.createSheet to properly increment sheetId</action>

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java?rev=775500&r1=775499&r2=775500&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java Sat May 16 17:39:31 2009
@@ -147,7 +147,7 @@
         if (format != null) {
             return format;
         }
-        if (formatStr.equals("General")) {
+        if (formatStr.equals("General") || formatStr.equals("@")) {
             if (DataFormatter.isWholeNumber(cellValue)) {
                 return generalWholeNumFormat;
             }

Added: poi/trunk/src/testcases/org/apache/poi/hssf/data/47154.xls
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/data/47154.xls?rev=775500&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/src/testcases/org/apache/poi/hssf/data/47154.xls
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java?rev=775500&r1=775499&r2=775500&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java Sat May 16 17:39:31 2009
@@ -21,6 +21,8 @@
 import java.text.Format;
 import java.util.Iterator;
 
+import org.apache.poi.hssf.HSSFTestDataSamples;
+
 import junit.framework.TestCase;
 
 /**
@@ -267,6 +269,24 @@
 			assertTrue(formatter.formatCellValue(cell).endsWith(" USD"));
 		}
 	}
+	
+	/**
+	 * A format of "@" means use the general format
+	 */
+	public void testGeneralAtFormat() {
+        HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("47154.xls");
+        HSSFSheet sheet       = workbook.getSheetAt(0);
+        HSSFRow   row         = sheet.getRow(0);
+        HSSFCell  cellA1      = row.getCell(0);
+        
+        assertEquals(HSSFCell.CELL_TYPE_NUMERIC, cellA1.getCellType());
+        assertEquals(2345.0, cellA1.getNumericCellValue(), 0.0001);
+        assertEquals("@", cellA1.getCellStyle().getDataFormatString());
+
+        HSSFDataFormatter f = new HSSFDataFormatter();
+        
+        assertEquals("2345", f.formatCellValue(cellA1));
+	}
 
 	private static void log(String msg) {
 		if (false) { // successful tests should be silent



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org