[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18909: Check for max columns for excel tables, must respect legacy limit of 256 cols for JXL API

revision-diff.txt (1.47 KB)

Hi

That legacy limitation is annoying, and there are two presumably simple ways around it:

Create multiple work sheets. Since probably 98% of all DHIS users with MS Office now have Office 2007/2010/2013 (which supports the xlsx and xlsm formats), they can simply use copy and paste in excel to create one sheet with more than 255 columns if needed.

Suggest exporting csv format instead - which can be opened in MS Excel 2007/2010/2013

Regards

Calle

···

On 15 April 2015 at 18:49, noreply@launchpad.net wrote:


revno: 18909

committer: Lars Helge Overland larshelge@gmail.com

branch nick: dhis2

timestamp: Wed 2015-04-15 18:48:14 +0200

message:

Check for max columns for excel tables, must respect legacy limit of 256 cols for JXL API

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-03-31 12:52:08 +0000

+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java 2015-04-15 16:48:14 +0000

@@ -104,6 +104,7 @@

 private static final String EMPTY = "";

 private static final String XLS_SHEET_PREFIX = "Sheet ";
  • private static final int JXL_MAX_COLS = 256;

    private static final NodeFilter HTML_ROW_FILTER = new OrFilter( new TagNameFilter( “td” ), new TagNameFilter( “th” ) );

@@ -271,6 +272,13 @@

         return;

     }
  •    int cols = grid.getVisibleHeaders().size();
    
  •    if ( cols > JXL_MAX_COLS )
    
  •    {
    
  •        log.warn( "Grid will be truncated, no of columns is greater than JXL max limit: " + cols + "/" + JXL_MAX_COLS );
    
  •    }
    
     WritableSheet sheet = workbook.createSheet( sheetName, sheetNo );



     int rowNumber = 1;

@@ -312,6 +320,11 @@

                 sheet.addCell( new Label( columnIndex++, rowNumber, content, XLS_FORMAT_TEXT ) );

             }
  •            if ( columnIndex >= JXL_MAX_COLS )
    
  •            {
    
  •                break;
    
  •            }
    
           }
    
    
    
           rowNumber++;
    

Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19274

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Yes agreed. There are ways to produce xlsx workbooks (through the POI java library) but it requires a bigger rewrite, this just to avoid lots of unnecessary warnings.

···

On Thu, Apr 16, 2015 at 4:53 PM, Calle Hedberg calle.hedberg@gmail.com wrote:

Hi

That legacy limitation is annoying, and there are two presumably simple ways around it:

Create multiple work sheets. Since probably 98% of all DHIS users with MS Office now have Office 2007/2010/2013 (which supports the xlsx and xlsm formats), they can simply use copy and paste in excel to create one sheet with more than 255 columns if needed.

Suggest exporting csv format instead - which can be opened in MS Excel 2007/2010/2013

Regards

Calle


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 15 April 2015 at 18:49, noreply@launchpad.net wrote:


revno: 18909

committer: Lars Helge Overland larshelge@gmail.com

branch nick: dhis2

timestamp: Wed 2015-04-15 18:48:14 +0200

message:

Check for max columns for excel tables, must respect legacy limit of 256 cols for JXL API

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-03-31 12:52:08 +0000

+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java 2015-04-15 16:48:14 +0000

@@ -104,6 +104,7 @@

 private static final String EMPTY = "";

 private static final String XLS_SHEET_PREFIX = "Sheet ";
  • private static final int JXL_MAX_COLS = 256;

    private static final NodeFilter HTML_ROW_FILTER = new OrFilter( new TagNameFilter( “td” ), new TagNameFilter( “th” ) );

@@ -271,6 +272,13 @@

         return;

     }
  •    int cols = grid.getVisibleHeaders().size();
    
  •    if ( cols > JXL_MAX_COLS )
    
  •    {
    
  •        log.warn( "Grid will be truncated, no of columns is greater than JXL max limit: " + cols + "/" + JXL_MAX_COLS );
    
  •    }
    
     WritableSheet sheet = workbook.createSheet( sheetName, sheetNo );



     int rowNumber = 1;

@@ -312,6 +320,11 @@

                 sheet.addCell( new Label( columnIndex++, rowNumber, content, XLS_FORMAT_TEXT ) );

             }
  •            if ( columnIndex >= JXL_MAX_COLS )
    
  •            {
    
  •                break;
    
  •            }
    
           }
    
    
    
           rowNumber++;
    

Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19274

Email: calle.hedberg@gmail.com

Skype: calle_hedberg