Column Hiding

To dynamically hide columns in your Excel export you can use one of two methods of XLSTransformer class

  • void setColumnsToHide(short[] columnsToHide) - sets the numbers of columns to hide
  • void setColumnPropertyNamesToHide(String[] columnPropertyNamesToHide) - sets the names of the properties for which all containing them columns should be hidden

Sample 1. If we would like to hide columns 1 and 3 in result XLS we have to pass this numbers as parameters to the firs method

                xlsTransformer.setColumnsToHide(new short[]{ (short)1, (short)3 } );

Sample 2. If we know the property names which should be hidden in corresponding columns we use code like

                xlsTransformer.setColumnPropertyNamesToHide( new String[]{"employee.age"} );

This code will hide column that contains employee.age property.