private SheetConfiguration getSheetConfiguration ( final Sheet sheet , final String formName , final int sheetRightCol ) { SheetConfiguration sheetConfig = new SheetConfiguration ( ) ; sheetConfig . setFormName ( formName ) ; sheetConfig . setSheetName ( sheet . getSheetName ( ) ) ; int leftCol = sheet . getLeftCol ( ) ; int lastRow = sheet . getLastRowNum ( ) ; int firstRow = sheet . getFirstRowNum ( ) ; int rightCol = 0 ; int maxRow = 0 ; for ( Row row : sheet ) { if ( row . getRowNum ( ) > TieConstants . TIE_WEB_SHEET_MAX_ROWS ) { break ; } maxRow = row . getRowNum ( ) ; int firstCellNum = row . getFirstCellNum ( ) ; if ( firstCellNum >= 0 && firstCellNum < leftCol ) { leftCol = firstCellNum ; } 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 String tempStr = TieConstants . CELL_ADDR_PRE_FIX + WebSheetUtility . getExcelColumnName ( leftCol ) + TieConstants . CELL_ADDR_PRE_FIX + "0 : " + TieConstants . CELL_ADDR_PRE_FIX + WebSheetUtility . getExcelColumnName ( rightCol ) + TieConstants . CELL_ADDR_PRE_FIX + "0" ; sheetConfig . setFormHeaderRange ( tempStr ) ; sheetConfig . setHeaderCellRange ( new CellRange ( tempStr ) ) ; // 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 tempStr = TieConstants . CELL_ADDR_PRE_FIX + WebSheetUtility . getExcelColumnName ( leftCol ) + TieConstants . CELL_ADDR_PRE_FIX + ( firstRow + 1 ) + " : " + TieConstants . CELL_ADDR_PRE_FIX + WebSheetUtility . getExcelColumnName ( rightCol ) + TieConstants . CELL_ADDR_PRE_FIX + ( lastRow + 1 ) ; sheetConfig . setFormBodyRange ( tempStr ) ; sheetConfig . setBodyCellRange ( new CellRange ( tempStr ) ) ; sheetConfig . setFormBodyType ( org . tiefaces . common . TieConstants . FORM_TYPE_FREE ) ; sheetConfig . setCellFormAttributes ( new HashMap < String , List < CellFormAttributes > > ( ) ) ; // check it's a hidden sheet int sheetIndex = parent . getWb ( ) . getSheetIndex ( sheet ) ; if ( parent . getWb ( ) . isSheetHidden ( sheetIndex ) || parent . getWb ( ) . isSheetVeryHidden ( sheetIndex ) ) { sheetConfig . setHidden ( true ) ; } return sheetConfig ; }
Gets the sheet configuration .