← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18936: XLS download, restrict max columns

 

------------------------------------------------------------
revno: 18936
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-04-17 12:47:58 +0200
message:
  XLS download, restrict max columns
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java	2015-04-15 16:48:14 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java	2015-04-17 10:47:58 +0000
@@ -297,7 +297,9 @@
             rowNumber++;
         }
         
-        for ( GridHeader header : grid.getVisibleHeaders() )
+        List<GridHeader> headers = ListUtils.subList( grid.getVisibleHeaders(), 0, JXL_MAX_COLS );
+        
+        for ( GridHeader header : headers )
         {
             sheet.addCell( new Label( columnIndex++, rowNumber, header.getColumn(), XLS_FORMAT_LABEL ) );
         }
@@ -308,7 +310,9 @@
         {
             columnIndex = 0;
 
-            for ( Object column : row )
+            List<Object> colums = ListUtils.subList( row, 0, JXL_MAX_COLS );
+            
+            for ( Object column : colums )
             {
                 if ( column != null && MathUtils.isNumeric( String.valueOf( column ) ) )
                 {
@@ -320,11 +324,6 @@
                     
                     sheet.addCell( new Label( columnIndex++, rowNumber, content, XLS_FORMAT_TEXT ) );
                 }
-                
-                if ( columnIndex >= JXL_MAX_COLS )
-                {
-                    break;
-                }
             }
 
             rowNumber++;