← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1039: Improved previewing out excel's content more exactly

 

------------------------------------------------------------
revno: 1039
committer: hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2009-11-17 12:30:13 +0700
message:
  Improved previewing out excel's content more exactly
modified:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/action/XMLStructureResponse.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/action/XMLStructureResponse.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/action/XMLStructureResponse.java	2009-11-16 04:56:59 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/action/XMLStructureResponse.java	2009-11-17 05:30:13 +0000
@@ -298,6 +298,8 @@
                         bFormula = true;
                         recalculatedValue = "";
 
+                        // CELL_TYPE_NUMERIC if this cell is an
+                        // NumbericCell
                         switch ( evaluator.evaluateInCell( cellRef ).getCellType() )
                         {
                         case org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC:
@@ -311,6 +313,12 @@
                             System.out.println( "Place of cell :: [" + cellRef.getRowIndex() + "]["
                                 + cellRef.getColumnIndex() + "]" );
                             break;
+
+                        // CELL_TYPE_ERROR if this cell is an ErrorCell
+                        case org.apache.poi.ss.usermodel.Cell.CELL_TYPE_ERROR:
+
+                            recalculatedValue = cell[j].getContents();
+                            break;
                         }
                     }
 
@@ -321,7 +329,7 @@
 
                     if ( bFormula )
                     {
-                        STRUCTURE_DATA_RESPONSE.append( "<![CDATA[" 
+                        STRUCTURE_DATA_RESPONSE.append( "<![CDATA["
                             + StringUtils.checkingNumberDecimal( recalculatedValue ) + "]]>" );
                     }
                     else
@@ -465,4 +473,19 @@
         }
     }
 
+    // -------------------------------------------------------------------------
+    // main method
+    // -------------------------------------------------------------------------
+
+    public static void main( String[] args )
+        throws Exception
+    {
+        // String fileName = "GenerateBaoCaoCongTacNam.xls";
+        String fileName = "admin17.11.2009.10.24.00.AMBaoCaoCongTacThang.xls";
+
+        System.out.println( new XMLStructureResponse( "c:\\Program Files\\DHIS2OH-2.0\\config\\excelreporting\\temp\\"
+            + fileName, "UTF8", 1, true, false, true, false, false ).getSTRUCTURE_DATA_RESPONSE() );
+
+    }
+
 }