public static AnchorSize getAnchorSize ( final Sheet sheet1 , final FacesCell fcell , final Cell cell , final ClientAnchor anchor ) { if ( ! ( sheet1 instanceof XSSFSheet ) ) { return null ; } double picWidth = 0.0 ; double picHeight = 0.0 ; int left = anchor . getDx1 ( ) / org . apache . poi . util . Units . EMU_PER_PIXEL ; int top = ( int ) ( ( double ) anchor . getDy1 ( ) / org . apache . poi . util . Units . EMU_PER_PIXEL / WebSheetUtility . PICTURE_HEIGHT_ADJUST ) ; int right = anchor . getDx2 ( ) / org . apache . poi . util . Units . EMU_PER_PIXEL ; int bottom = ( int ) ( ( double ) anchor . getDy2 ( ) / org . apache . poi . util . Units . EMU_PER_PIXEL / WebSheetUtility . PICTURE_HEIGHT_ADJUST ) ; double cellWidth = 0.0 ; double cellHeight = 0.0 ; if ( ( cell != null ) && ( fcell != null ) ) { for ( int col = cell . getColumnIndex ( ) ; col < cell . getColumnIndex ( ) + fcell . getColspan ( ) ; col ++ ) { cellWidth += sheet1 . getColumnWidthInPixels ( col ) ; } double lastCellWidth = sheet1 . getColumnWidthInPixels ( cell . getColumnIndex ( ) + fcell . getColspan ( ) - 1 ) ; for ( int rowIndex = cell . getRowIndex ( ) ; rowIndex < cell . getRowIndex ( ) + fcell . getRowspan ( ) ; rowIndex ++ ) { cellHeight += WebSheetUtility . pointsToPixels ( sheet1 . getRow ( rowIndex ) . getHeightInPoints ( ) ) ; } double lastCellHeight = WebSheetUtility . pointsToPixels ( sheet1 . getRow ( cell . getRowIndex ( ) + fcell . getRowspan ( ) - 1 ) . getHeightInPoints ( ) ) ; picWidth = cellWidth - lastCellWidth + right - left ; picHeight = cellHeight - lastCellHeight + bottom - top ; } else { for ( short col = anchor . getCol1 ( ) ; col < anchor . getCol2 ( ) ; col ++ ) { picWidth += sheet1 . getColumnWidthInPixels ( col ) ; } for ( int rowindex = anchor . getRow1 ( ) ; rowindex < anchor . getRow2 ( ) ; rowindex ++ ) { Row row = sheet1 . getRow ( rowindex ) ; if ( row != null ) { picHeight += WebSheetUtility . pointsToPixels ( row . getHeightInPoints ( ) ) ; } } } return new AnchorSize ( left , top , ( int ) picWidth , ( int ) picHeight , cellWidth , cellHeight ) ; }
Gets the anchor size .