public WorkSheet swapRowAndColumns ( ) throws Exception { WorkSheet swappedWorkSheet = new WorkSheet ( getColumns ( ) , getRows ( ) ) ; for ( String row : getRows ( ) ) { for ( String col : getColumns ( ) ) { String value = getCell ( row , col ) ; swappedWorkSheet . addCell ( col , row , value ) ; } } ArrayList < String > metadataRows = this . getMetaDataRows ( ) ; ArrayList < String > metadataColumns = this . getMetaDataColumns ( ) ; swappedWorkSheet . setMetaDataColumns ( metadataRows ) ; swappedWorkSheet . setMetaDataRows ( metadataColumns ) ; return swappedWorkSheet ; }
Swap the row and columns returning a new worksheet