java poi shfitRow 图片跟着移动

		for (POIXMLDocumentPart dr : sheet.getRelations()) {
		    if (dr instanceof XSSFDrawing) {
		        XSSFDrawing drawing = (XSSFDrawing) dr;
		        List<XSSFShape> shapes = drawing.getShapes();
		        for (XSSFShape shape : shapes) {
		            XSSFPicture pic = (XSSFPicture) shape;
		            //可能变形
		            //XSSFClientAnchor anchor = pic.getPreferredSize()
		            XSSFClientAnchor anchor = pic.getClientAnchor();
		            anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_DONT_RESIZE);
		            anchor.setRow1(writeRownum - writeConfigure.getWriteRownum() + anchor.getRow1());
		            anchor.setRow2(writeRownum - writeConfigure.getWriteRownum() + anchor.getRow2());
		        }
		    }
		}

  

  



找时间整理下
posted @ 2017-11-08 21:30  AGuangX  阅读(1227)  评论(0)    收藏  举报