private SheetConfiguration getSheetConfigurationFromConfigCommand ( final Sheet sheet , final FormCommand fcommand , final int sheetRightCol ) { SheetConfiguration sheetConfig = new SheetConfiguration ( ) ; sheetConfig . setFormName ( fcommand . getName ( ) ) ; sheetConfig . setSheetName ( sheet . getSheetName ( ) ) ; int leftCol = fcommand . getLeftCol ( ) ; int lastRow = fcommand . getLastRow ( ) ; int rightCol = 0 ; int maxRow = 0 ; for ( Row row : sheet ) { if ( row . getRowNum ( ) > TieConstants . TIE_WEB_SHEET_MAX_ROWS ) { break ; } maxRow = row . getRowNum ( ) ; if ( ( row . getLastCellNum ( ) - 1 ) > rightCol ) { int verifiedcol = verifyLastCell ( row , rightCol , sheetRightCol ) ; if ( verifiedcol > rightCol ) { rightCol = verifiedcol ; } } } if ( maxRow < lastRow ) { lastRow = maxRow ; } // header range row set to 0 while column set to first column to // max // column (FF) e.g. $A$0 : $FF$0 setHeaderOfSheetConfiguration ( fcommand , sheetConfig , leftCol , rightCol ) ; // body range row set to first row to last row while column set // to // first column to max column (FF) e.g. $A$1 : $FF$1000 setBodyOfSheetConfiguration ( fcommand , sheetConfig , leftCol , lastRow , rightCol ) ; // footer range row set to 0 while column set to first column to // max // column (FF) e.g. $A$0 : $FF$0 setFooterOfSheetConfiguration ( fcommand , sheetConfig , leftCol , rightCol ) ; String hidden = fcommand . getHidden ( ) ; if ( ( hidden != null ) && ( Boolean . parseBoolean ( hidden ) ) ) { sheetConfig . setHidden ( true ) ; } String fixedWidthStyle = fcommand . getFixedWidthStyle ( ) ; if ( ( fixedWidthStyle != null ) && ( Boolean . parseBoolean ( fixedWidthStyle ) ) ) { sheetConfig . setFixedWidthStyle ( true ) ; } sheetConfig . setFormCommand ( fcommand ) ; return sheetConfig ; }
Create sheet configuration from form command .